Skip to content

TD-5224: a system-wide stop shortcut for computer use (engage only) - #110

Merged
captcrock merged 1 commit into
mainfrom
td/5224-stop-hotkey
Nov 2, 2026
Merged

captcrock merged 1 commit into
mainfrom
td/5224-stop-hotkey

Conversation

@captcrock

Copy link
Copy Markdown
Contributor

Stacked on #109 (TD-5223). This PR targets td/5223-stop-file. Once #109 merges, retarget it to main.

What

A system-wide shortcut that stops computer use on the whole machine, even while TST Desk is in the background. ⌘. / Ctrl+. only works when TST Desk is the front window, and during computer use the agent is usually in another app.

  • Default Ctrl+Alt+Super+Period (⌃⌥⌘. on macOS), set by computer_use.stop_shortcut; empty turns it off. Read at launch. It doesn't take ⌘. system-wide, since many apps use that for Cancel; the in-window ⌘. is unchanged.
  • Same stop-file as the title-bar Stop (TD-5223), so every computer-use client halts, including ones TST Desk didn't start. The app writes the file itself, so the shortcut works while the daemon is busy; the daemon's once-a-second check then updates every window.
  • Engage only. It never removes the file. An agent can press key combos, so a toggle would let it switch itself back on. Resume stays a click in TST Desk.
  • One global-shortcut plugin. It's now built once in lib.rs, and each shortcut registers its own handler (on_shortcut). Quick entry (macOS) moved to that too; before, it built the plugin with a single handler.
  • Config model, shipped config.yaml, Settings help text, docs/configuration.md (plus a short section on the machine-wide Stop), DECISIONS (2026-11-02, TD-5224) and backlog (TD-5224).

Tests (each shown to fail when its piece is broken)

  • shell stop_hotkey (6): unset → default; a custom combo; empty → off; the default parses to Ctrl+Alt+Super+. and is not ⌘.; pressing creates the stop-file at the resolved path (default, and killswitch.stop_file from the tst-cu-mcp config); pressing again while stopped keeps it stopped. Mutations checked: turning engage into a toggle, defaulting to Super+Period, and ignoring "empty is off" each fail a test.
  • core test_stop_shortcut_config.py (4): model default, shipped config, empty/custom values, docs row.

Suites (Linux)

  • core: 8400 passed, 12 skipped; ruff and ruff format clean; mypy --strict tstd clean
  • ui: 190 files, 2722 passed; svelte-check 0 errors, 0 warnings
  • shell: cargo test --lib 131 passed; cargo clippy --all-targets -D warnings clean
  • mcp/tst-cu-mcp: 616 passed, 3 skipped, 3 failed: pre-existing (DarwinBackend.hit_test nested in _mark_prompted, other in-flight work)

Not verified here

  • The shortcut firing on a real desktop. The installed app on the test machine is a different build, and the app is single-instance, so I didn't launch this branch next to it. The registration and press handler are covered by unit tests only.
  • macOS compile of quick_entry.rs. That code is macOS-only and CI builds on Linux. It now calls the same on_shortcut API the stop shortcut uses (which builds and runs here), but the Mac build is the real check.
  • Live macOS check, for the Mac session: press ⌃⌥⌘. with another app in front → the stop-file exists, an outside client's clicks are refused, TST Desk shows "CU stopped" within a second; press it again → still stopped; Resume in TST Desk clears it; quick entry (⇧⌘.) still opens.

🤖 Generated with Claude Code

@captcrock
captcrock force-pushed the td/5224-stop-hotkey branch from b37d9f3 to ddb7029 Compare November 2, 2026 21:02
@captcrock
captcrock changed the base branch from td/5223-stop-file to main November 2, 2026 21:03
Cmd+. / Ctrl+. only works while TST Desk is the front window, and during
computer use the agent is usually in another app. The app now registers a
global shortcut, default Ctrl+Alt+Super+Period (Ctrl+Opt+Cmd+. on macOS),
that creates the same machine-wide stop-file as the title-bar Stop
(TD-5223), so every computer-use client halts.

It only engages. An agent can press key combos, so a toggle would let it
switch itself back on; resume stays a click in TST Desk. It does not take
Cmd+. system-wide, since many apps use that for Cancel.

The combo is computer_use.stop_shortcut (empty turns it off), read at
launch. The app writes the file itself, so the shortcut works while the
daemon is busy; the daemon's check then updates every window.

The global-shortcut plugin is now built once and each shortcut registers
its own handler, so quick entry (macOS) and the stop shortcut share it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@captcrock
captcrock force-pushed the td/5224-stop-hotkey branch from ddb7029 to c6f42bf Compare November 2, 2026 21:04
@captcrock
captcrock merged commit e35c3d2 into main Nov 2, 2026
4 checks passed
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