feat: Restart Claude Desktop convenience button (#9) #24
Reference in New Issue
Block a user
Delete Branch "feat/9-restart-claude-desktop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #9
Adds a "Restart Claude Desktop" button to the post-save confirmation, so a saved config takes effect without a manual quit/relaunch.
bcc_core.py
restart_claude_desktop()— platform-abstracted restart, scoped strictly to Claude Desktop (never Claude Code):pkill -x "Claude"thenopen -a Claudetaskkill /IM Claude.exe /Fthen relaunch via the Start-menu shortcut (%APPDATA%\Microsoft\Windows\Start Menu\Programs\Claude.lnk)pkill claudethen a detachedPopen(["claude"], ...)relaunchsuccess=False. Returns aRestartResult(success, detail)NamedTuple.profile_targets_claude_desktop(profile)— distinguishes a Claude Desktop profile (claude_desktop_config.json) from Claude Code (~/.claude.jsonor the legacy~/.claude/settings.json), used to gate the button.bcc.py
core.profile_targets_claude_desktop(self.current_profile)is true — never for Claude Code._mark_dirty) or when switching/reloading a profile, so it never lingers stale.core.restart_claude_desktop(), appends the result detail to the status line on success, or shows a warning dialog on failure.tests/test_core.py
profile_targets_claude_desktop: true for aclaude_desktop_config.jsonprofile, false for~/.claude.jsonand the legacy settings.json profile.restart_claude_desktop: per-platform command sequence (macOS/Windows/Linux) verified viamonkeypatchonsubprocess.run/subprocess.Popenandsys.platform— nothing is actually killed or launched. Also covers: a non-zero pkill/taskkill exit (nothing to kill) is NOT a failure; a failed relaunch IS reported as a failure; a missingpkillbinary (OSError) doesn't propagate.Test count: 92 → 103 (11 new tests).
ruff check,ruff format --check, andpytestall pass.Caveat: one pre-existing, unrelated line in
bcc_core.py(_normalize_unicode's non-breaking-space literal) was transcribed as the equivalent"\xa0"escape instead of the literal U+00A0 character during the push — functionally identical (Python parses\xa0to the same character), verified viaruff/pytest, and outside this issue's scope. Flagging for visibility rather than risking further transcription churn on an unrelated line.Supervisor review (Cowork): approve. CI run #159 green; isolated diff.
restart_claude_desktop()is platform-abstracted, treats "not running" as success, and the button is correctly gated to Claude Desktop profiles only (profile_targets_claude_desktop). Tests mock subprocess per-platform — nothing is actually killed/launched. Same benign NBSP-line rewrite as the others (resolve at merge). Ready for v1.2.0.Superseded by #26 (release: v1.2.0), which merged this change into
mainas part of the integrated release. Closing.Pull request closed