Skip to content

fix(linux): bring the Ctrl-Tab switcher to macOS parity - #45

Merged
melonamin merged 3 commits into
melonamin:linux-portfrom
n2tr2:linux-ctrl-tab-parity
Oct 5, 2026
Merged

melonamin merged 3 commits into
melonamin:linux-portfrom
n2tr2:linux-ctrl-tab-parity

Conversation

@n2tr2

@n2tr2 n2tr2 commented Sep 30, 2026

Copy link
Copy Markdown

Brings the GTK Ctrl-Tab session switcher to parity with macOS SessionSwitcher.swift. macOS is the reference and is unchanged. The cycle core was already right: MRU snapshot, index 1 preselected, Shift reverses, Esc cancels, and releasing Ctrl commits. These are the gaps around it.

Gap Before (v0.33.1) After
Modal gate Ctrl-Tab selects a session behind a terminal zoom, the dashboard, a modal pick, an AdwDialog or a popover refused as macOS canSwitch does; checked again at commit time, so a modal that opens mid-hold commits nothing
Theme hardcoded alpha(#1e2228, 0.96) card with themed text, which is unreadable on light themes; the current row is only bold/opacity popover tokens; the current row uses the sidebar's selection colors
Visibility rows rebuilt on every Tab and never scrolled, so the highlight falls below the fold rows built once per cycle; the whole highlighted row is revealed. The palette and pickers get the same fix, since libadwaita's 2px list > row padding was clipped
Placement centered over the whole window, sidebar and titlebar included 12% down over the terminal area with a 0.2 dim, using InterfaceMetrics width and offset clamp; rounded card chrome sits on the scroller frame
Input scope a sidebar rename entry or the search bar turns Ctrl-Tab into a GTK focus move one capture-phase window controller owns Ctrl-Tab, active-cycle Esc, held-Ctrl tracking and the deferred release commit; Ctrl-Tab stays reserved
Cancel an Alt-Tab away or an opened popover leaves a live cycle window deactivation and popupPopover cancel it

Row subtitles (workspace · detail, remote glyph) come from umputun#650 and are kept as upstream renders them.

Screenshots

Before is linux-v0.33.1, after is this branch. Both are isolated instances with 11 sessions, Ctrl held after two Tabs (the scroll shot: nine Tabs, 1100×440 window).

Before After
Dark
Light (Atom One Light)
Last row, short window

Testing

  • swift test (454 tests) and swiftlint lint --strict pass.
  • New unit suite SessionSwitcherTests: gate terms, placement and clamp, card chrome bounds, reveal retry, CSS tokens, key classification.
  • New AT-SPI scenarios whose first run is in this PR's CI: session-switch-zoom, -scroll, -sessionless, -leader, -entry, -deactivate. There are also placement, dim and subtitle assertions in session-switch-commit.
  • The light screenshot sets its theme before the sessions exist. That works around an existing hang, separate from this PR and present in 0.32.0 too: theme set with about 11 surfaces blocks the main thread inside ghostty_app_update_config. It will be filed separately.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y6w9aeeiTMG3Kj2ZNbveyq

@n2tr2
n2tr2 requested a review from melonamin as a code owner September 30, 2026 19:23
@n2tr2
n2tr2 force-pushed the linux-ctrl-tab-parity branch from bb9a16e to 10522e9 Compare September 30, 2026 20:19
- Refuse a cycle under terminal zoom, the dashboard, a modal pick, a
  visible AdwDialog or an open popover, and re-check at commit so a
  modal that arrives mid-hold selects nothing.
- Theme the card from the popover tokens and give the current row the
  sidebar's selection colors instead of a hardcoded dark fill.
- Build the rows once per cycle and reveal the highlighted row's whole
  border box, so it never sits below the fold; the palette and pickers
  share the fixed reveal.
- Place the card 12% down over the terminal area with a 0.2 dim, using
  InterfaceMetrics' panel width and offset clamp.
- Own switcher input with one capture-phase window controller, so
  Ctrl-Tab cycles from the search bar and a rename entry too; Ctrl-Tab
  stays reserved and is consumed even when no cycle begins.
- Cancel a live cycle on window deactivation and popover open.
- AT-SPI scenarios cover zoom, scroll, sessionless, leader, entry and
  deactivation legs.

Claude-Session: https://claude.ai/code/session_01Y6w9aeeiTMG3Kj2ZNbveyq
@n2tr2
n2tr2 force-pushed the linux-ctrl-tab-parity branch from 10522e9 to 5d619b9 Compare October 1, 2026 15:30
n2tr2 added a commit to n2tr2/agterm-linux that referenced this pull request Oct 1, 2026
Ports macOS's zmx, Live-session and remote-session behaviour to the GTK
frontend on linux-v0.33.1 (unchanged on macOS since v0.32). Stacked on melonamin#45.

- Exit capture follows the configured exit mode, keeps raw argv and
  unconsumed pending replay, and reads zmx foregrounds from one fresh
  bounded snapshot per pass; launch replay is latched to the launch restore
  decision, which restore.set's pin notice names.
- A presenter's ask rejection takes back only that ask; held exits of
  replica panes and overlays run a hop after the callback and act only on
  the surface still in its slot. A stale session-overlay exit no longer
  closes a program or HTML page that took the slot.
- Covered (follower) panes route keys through the keymap, then one takeover
  policy: the first other key takes the lead once, and neither its repeats
  nor modifier releases reach the PTY. The Ctrl-Tab commit stays with melonamin#45's
  window-level controller.
- Remote rows get the bundled agterm-remote-symbolic glyph in the sidebar,
  Ctrl-Tab and popovers, plus a sidebar-only disconnected variant; local
  launches from a remote row start in a local directory.
- zmx kill confirmations are read from stderr and attach is validated
  before ssh.
- A pending clipboard read rereads the live surface before completing,
  instead of a pointer a lead takeover may have freed.
- Tests: presenter-frame fixtures seed follower roles under v0.33's lead
  gate; new suites for overlay exit identity, the key policy, held exits and
  foreground capture; the remote AT-SPI scenario covers both origin panes
  following, a covered-follower zoom leg, an origin-led ask and the
  returned ask on the viewer.
- Docs: Linux contracts in .claude/rules and agterm-linux/docs; the skill's
  outdated flag and Live-sessions reset are scoped to macOS.

Claude-Session: https://claude.ai/code/session_01P8k6PLdo5pmHZgytbrdevm
@melonamin
melonamin merged commit c66f4e9 into melonamin:linux-port Oct 5, 2026
5 checks passed
melonamin added a commit that referenced this pull request Oct 5, 2026
fix(linux): bring zmx, Live and remote sessions to macOS v0.33 parity (merge after #45)
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