Skip to content

fix(linux): dispatch window key actions - #31

Merged
melonamin merged 1 commit into
melonamin:linux-portfrom
MemberIT:fix/linux-window-key-dispatch
Sep 3, 2026
Merged

melonamin merged 1 commit into
melonamin:linux-portfrom
MemberIT:fix/linux-window-key-dispatch

Conversation

@MemberIT

@MemberIT MemberIT commented Aug 28, 2026 •

Copy link
Copy Markdown

What

On Linux, rename_window and delete_window are valid built-in keymap actions, but assigning either action in keymap.conf produces a shortcut that is consumed without doing anything. The same window rename and delete operations already work through the GTK palette/context-menu dialogs and through the control API; only the built-in key dispatch path is missing.

This PR routes both mapped actions through the current Linux window controller's existing dialog paths. It restores upstream macOS behavior without adding default chords: both actions remain mappable-only, matching BuiltinAction.defaultChord == nil upstream.

Cause

AppController.dispatchBuiltin is the exhaustive Linux adapter from BuiltinAction to GTK behavior. Its renameWindow and deleteWindow cases were explicit no-ops:

case .renameWindow: break
case .deleteWindow: break

handleKey still returned true after calling this dispatcher, so the configured chord was consumed and could not fall through. The Linux UI already had the required implementations in AppControllerContextMenus.swift: renameWindowDialog(_:) and confirmDeleteWindow(_:).

Minimal reproduction

  1. Add explicit mappings to <configDir>/keymap.conf, for example:

    map ctrl+alt+r rename_window
    map ctrl+alt+x delete_window
    
  2. Reload the keymap.

  3. Press either mapped chord in an agterm-linux terminal window.

Expected (upstream parity): rename_window opens the pre-filled Rename Window dialog; delete_window opens the destructive Delete Window confirmation when another library window exists.

Actual before this PR: the chord is consumed and nothing appears.

Neither action gains a shipped default shortcut. They run only when the user explicitly maps them, as on macOS.

Change (1 commit, 1 implementation file + 1 UI test file)

Commit fix(linux): dispatch window key actions:

  • agterm-linux/Sources/AgtermLinux/KeymapDispatch.swift — replaces the two no-op switch arms with renameWindowDialog(windowID) and confirmDeleteWindow(windowID). Using the handling AppController's windowID scopes the action to the exact terminal window that received the key event, rather than whichever global window pointer happened to be active.
  • agterm-linux/tests/atspi_smoke.py — adds the isolated window-key-dispatch scenario. It writes explicit mappings for both mappable-only actions, creates a survivor window, sends real X11 keyboard input to the original window, drives the existing dialogs through accessible pointer input, verifies rename/delete via control read-back, and confirms that deleting the target leaves both the survivor window and the application running.

No new action implementation or dialog is introduced; key dispatch reuses the same GTK paths already used by the palette and context menus.

Scope note

Linux built-in key dispatch only. BuiltinAction.defaultChord, BuiltinAction.linuxDefaultChord, keymap parsing and conflict resolution, window persistence, dialog wording, palette behavior, and control protocol behavior are unchanged.

In particular, this PR does not add default chords for rename_window or delete_window. Adding them would diverge from upstream macOS, where both actions are mappable-only.

Keep-in-sync

Control API already covered: window.rename and window.delete already expose these mutations, including existing dispatcher, CLI, protocol tests, and window-list read-back. This PR fixes one missing GUI/keymap caller and does not add a new capability.

The keymap format and the window/workspace/session/pane model are unchanged. The bundled agent skill command catalog and website command reference therefore need no update. No new setting or release behavior is introduced, so README.md and CHANGELOG.md are intentionally unchanged.

Testing

  • Shared agtermCore in swift:6.3.2-noble: 2570 tests / 97 suites passed. The command was chained with && into the succeeding Linux-package test and build stages.
  • Linux Swift package: 332 tests / 47 suites passed.
  • swift build --product AgtermLinux — passed.
  • swift build --product agtermctl-linux — passed.
  • Targeted GTK AT-SPI scenario: AGTERM_ATSPI_SCENARIO=window-key-dispatch scripts/test-linux-ui.sh — passed with OK: mapped rename_window and delete_window drive current-window dialogs.
  • swiftlint lint --strict --quiet with Swift 6.3.2 / SwiftLint 0.65.0 — clean.
  • python3 -m py_compile agterm-linux/tests/atspi_smoke.py — passed.
  • git diff --check — passed.
  • GitHub CI run 33161013462 on head 2e436a2: Detect changes passed, Unit tests (Linux) passed, SwiftLint (Linux) passed, and Build app (Linux GTK) passed, including the complete GTK AT-SPI smoke suite. Cookbook checks skipped because this PR changes no cookbook inputs.

@MemberIT
MemberIT requested a review from melonamin as a code owner August 28, 2026 09:50
@melonamin
melonamin force-pushed the fix/linux-window-key-dispatch branch from 2e436a2 to b35cdae Compare September 2, 2026 23:52
@melonamin
melonamin merged commit 56a570f into melonamin:linux-port Sep 3, 2026
5 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.

2 participants