Skip to content

Add built-in Settings window#5

Merged
peterp merged 3 commits intomainfrom
feat/settings-window
Apr 28, 2026
Merged

Add built-in Settings window#5
peterp merged 3 commits intomainfrom
feat/settings-window

Conversation

@peterp
Copy link
Copy Markdown
Owner

@peterp peterp commented Apr 28, 2026

SwiftUI Settings window opens from the Dock menu ("Settings…") or by clicking the Dock icon with no visible windows (`applicationShouldHandleReopen`). Exposes the two existing visual settings:

  • Animations — show/pick/peek transitions
  • Live previews — stream live frames vs static screenshots

Toggling either writes `~/Library/Application Support/cmdcmd/config.json` on change and applies live without restart (via `Overlay.updateConfig`).

Trigger and bindings stay in the JSON file ("Open Config…" button passes through). Saving via the UI re-encodes the file and drops template comments — bindings/trigger keys are preserved.

Credit to @plyght — adapted from #1.

Test plan

  • `./build-app.sh && open cmdcmd.app`
  • Right-click Dock icon → Settings… opens the window
  • Click Dock icon (with no window visible) → Settings… opens
  • Toggle Animations off, fire ⌘⌘ — overlay snaps without fade
  • Toggle Live previews off, fire ⌘⌘ — tiles show static screenshots
  • Confirm config.json reflects toggles, restart app — toggles persist
  • Edit `bindings` in config.json, save via UI — bindings preserved (re-open file to confirm)

🤖 Generated with Claude Code

peterp and others added 3 commits April 28, 2026 22:22
A SwiftUI Settings window opens from the Dock menu's "Settings…" item,
or by clicking the Dock icon when no windows are visible. Toggles for
"Animations" and "Live previews" save to ~/Library/Application Support/
cmdcmd/config.json on change and apply live without restart.

Saving via the UI re-encodes the JSON and drops template comments;
hand-edited bindings/trigger are preserved. Trigger and bindings are
not exposed in this window — edit config.json directly via "Open Config…".

Co-Authored-By: plyght <plyght@peril.lol>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace full re-encode with a small in-place patcher that scans the file
as text, skipping line comments and strings, and replaces only the value
of the requested top-level key. Inserts the key just before the root
closing brace if it doesn't exist (carries a trailing comma onto the
previous entry as needed).

Comments, key order, and any hand-formatting in config.json now survive
a Settings save round-trip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
With live previews disabled, tiles render a single screenshot and never
emit further frames, so lastSignificantChangeAt stays at init time and
every tile crosses the 2.5s idle threshold. Skip starting the activity
timer entirely in that mode so the dot stays hidden.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@peterp peterp merged commit e0fb4bc into main Apr 28, 2026
1 check passed
@peterp peterp deleted the feat/settings-window branch April 28, 2026 20:29
@peterp peterp mentioned this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant