Skip to content

Add a --background opt-out to CLI and deeplink focus-follow - #739

Merged
sbertix merged 2 commits into
mainfrom
sbertix/gh-722
Jul 29, 2026
Merged

Add a --background opt-out to CLI and deeplink focus-follow#739
sbertix merged 2 commits into
mainfrom
sbertix/gh-722

Conversation

@sbertix

@sbertix sbertix commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Closes #722

Summary

Every socket/CLI worktree and tab action moved the sidebar selection and
keyboard focus to the affected worktree, so a session driving Supacode
programmatically lost focus on every create and teardown.

This adds a --background flag (and a matching background=true deeplink
parameter) to every action that would otherwise focus its target:
repo worktree-new, worktree run/stop/archive/unarchive/delete/
pin/unpin, tab new/close, and surface split/close. It suppresses
both the cross-worktree selection and the intra-worktree activation: new
tabs, splits, and script tabs land in the background, and closes do not pull
focus back. The intent survives the interactive worktree-creation prompt,
the input-confirmation dialog, and the archive/delete lifecycle scripts.

Omitting the flag reproduces the previous behavior exactly, and the
dedicated focus commands do not accept it. Tab creation now expresses
selection and keyboard focus as one TabActivation value; background tabs
append so a run of them keeps its order, and the very first tab still
selects.

Also fixes bare worktree run/stop resolving their target from the
selected worktree instead of the one the command names, which suppressing
the selection would otherwise have turned into running the wrong script.

Known limitation: closing the focused surface of the currently selected tab
still transfers focus to the surviving pane, preserving the invariant that a
tab with visible leaves keeps a focused surface.

Type of change

  • Bug fix (the linked issue is a bug report)
  • Feature (the linked issue is a feature request marked ready)
  • Documentation
  • Other (please describe)

How was this tested?

Reducer tests cover the deeplink gate in both directions, the confirmation
round-trip, the pending-worktree path, malformed background values, the
tab-selection axis (ordering, first-tab selection), and the corrected
run/stop targeting against a non-selected worktree. Verified manually by
driving a second worktree from a live session with --background on tab
creation, splits, scripts, and lifecycle actions.

  • make check passes (format + lint)
  • make test passes
  • I built and ran the app to confirm the change works

Checklist

  • This pull request is linked to an issue with Closes # above.
  • For a feature, the linked issue is labeled ready.
  • I am the author of this work and accountable for it; no commit is authored or co-authored by an AI agent.
  • I have read the Contributing guide and the Code of Conduct.

sbertix added 2 commits July 29, 2026 23:43
Every socket/CLI worktree and tab action moved the sidebar selection and
keyboard focus to the affected worktree, so a session driving Supacode
programmatically lost focus on every create and teardown (#722).

`--background` (and the matching `background=true` deeplink parameter) keeps
the selection and keyboard focus where they are: new tabs, splits, and script
tabs land in the background instead of activating, and closes no longer pull
focus back. The intent survives the interactive worktree-creation prompt, the
input-confirmation dialog, and the archive and delete lifecycle scripts.
Omitting the flag reproduces the previous behavior exactly, and the dedicated
focus commands do not accept it.

Tab creation expresses selection and keyboard focus as one `TabActivation`
value, since the initial-tab path needs a selected but unfocused tab.
Background tabs append rather than inserting after the selection, so a run of
them keeps its order, and the very first tab still selects.

Also fixes bare `worktree run` and `worktree stop` resolving their target from
the selected worktree instead of the one the command names, which suppressing
the selection would otherwise have turned into running the wrong script.
Covers the in-app CLI and deeplink reference panes plus the installable skill
content, so the flag is discoverable from every surface that lists commands.
@sbertix
sbertix enabled auto-merge (squash) July 29, 2026 21:47
@sbertix
sbertix merged commit 7493147 into main Jul 29, 2026
3 checks passed
@sbertix
sbertix deleted the sbertix/gh-722 branch July 29, 2026 21:54
@mtomov

mtomov commented Jul 30, 2026

Copy link
Copy Markdown

Huge, thank you! ❤️

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.

Setting (or CLI flag) to suppress focus-follow on CLI worktree/tab actions

2 participants