Skip to content

Add pane swapping through the shared tmux pane picker - #498

Merged
kitknox merged 3 commits into
kitknox:mainfrom
joanfabregat:feat/tmux-pane-swap-picker
Sep 23, 2026
Merged

kitknox merged 3 commits into
kitknox:mainfrom
joanfabregat:feat/tmux-pane-swap-picker

Conversation

@joanfabregat

Copy link
Copy Markdown
Contributor

Scope

Depends on #497. This is a separate, stacked follow-up; #497 remains unchanged. The first commit is the zoom picker, and the final commit (fc39984) is the swap-only change. Keeping this draft until the shared picker lands and the Apple UI checks are completed.

Add Choose Pane to Swap for multi-pane tmux control-mode tabs, using the same picker, input/cancellation handling, layout preview, and lifecycle as zoom. The shared types are renamed to TmuxPaneSelection and TmuxPanePickerView, rather than introducing another implementation.

  • Mark the focused pane as “Current pane” and number only the other panes, including the two-pane case.
  • Selecting a number swaps positions while retaining focus on the original pane and preserving zoom. Canceling does not send a tmux command.
  • Default shortcut ⌘⌥S, configurable/unbindable in Keyboard Shortcuts, with Terminal and pane-context-menu entries. ⌘⌥M was avoided because macOS uses it to minimize all app windows (Apple reference).
  • Revalidate the active tab, source focus, and topology before sending a single window-qualified swap-pane -d -Z command. A source or target moved to another window must not be followed there.

Validation

  • 61 tests passed in the isolated Swift 6.2.4/Linux harness against tmux 3.6, retaining the zoom/layout tests and adding six swap-model tests plus two real control-mode tests.
  • Native tests cover source focus, zoom preservation, layout round-trips, reply alignment, and either pane moving to another window before selection.
  • Swift syntax checks passed for all changed Swift files; git diff --check passed. Only the local test process harness is adapted for Linux, not production code.
  • Not yet verified: Xcode build or interactive Apple UI behavior. The inherited keyboard handling still needs device validation, particularly Escape/other canceling keys, held-key repeats, and menu-command delivery without input reaching a terminal.

Apple UI checks

  • Remapped/unbound/default shortcut and both menu entries.
  • Two-pane and larger layouts, 10+ targets, zoomed preview, source marker, and retained focus after swapping.
  • Invalid keys/Escape cancel without forwarding input or triggering another command.
  • Layout/focus changes, tab switching, disconnect/backgrounding, multiple windows, and accessibility.

Build on the zoom picker from PR kitknox#497. Reuse its input handling and
lifecycle, exclude the focused pane from swap targets, and preserve
source focus and zoom with window-qualified native swap commands.

Default to Command-Option-S because Command-Option-M minimizes all
application windows on macOS. Add model and real control-mode tests.
Preserve the iPad focus and key-release handling from kitknox#497, along
with herdr zoom support. Keep swapping tmux-only and extend shared
picker regressions to cover both actions.
@joanfabregat

Copy link
Copy Markdown
Contributor Author

Updated to reuse your corrected picker from #497, preserving the iPad fixes and herdr zoom support while keeping swapping tmux-only. Extended the regression tests to both picker modes. All 63 Linux-compatible tests pass; Apple UI validation remains pending.

@kitknox

kitknox commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Is this ready for review? Its marked as draft still.

@joanfabregat

Copy link
Copy Markdown
Contributor Author

Yes, it’s ready for review! I kept it as draft because I couldn’t run the Apple UI checks from my Linux environment. The 63 Linux-compatible tests pass. I can mark it ready, with Apple UI validation still pending.

@joanfabregat
joanfabregat marked this pull request as ready for review September 22, 2026 21:53
Keep the swap picker shortcut alongside the new File Manager action in both keyboard command lists.
@joanfabregat

Copy link
Copy Markdown
Contributor Author

I’ve resolved the conflicts with current main, and GitHub now shows the PR as mergeable. Ready for review.

@kitknox
kitknox merged commit 8e862bb into kitknox:main Sep 23, 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.

2 participants