Skip to content

feat(linux): add desktop launcher actions - #35

Merged
melonamin merged 2 commits into
melonamin:linux-portfrom
MemberIT:feat/linux-desktop-actions
Sep 3, 2026
Merged

melonamin merged 2 commits into
melonamin:linux-portfrom
MemberIT:feat/linux-desktop-actions

Conversation

@MemberIT

Copy link
Copy Markdown

What

The Linux packages currently install a valid freedesktop desktop entry, but it exposes only the primary Exec=agterm-linux launch. Right-clicking a pinned or running agterm icon therefore has no product actions, even though upstream macOS exposes New Session, New Window, Quick Terminal, Dashboard, Recent Sessions, and Sessions Needing Attention from its Dock menu.

This PR adds the native Linux equivalent through freedesktop Desktop Entry Actions. Cinnamon 6.6 (Linux Mint 22.3), GNOME Shell/Ubuntu Dock, and KDE Plasma can render these standard actions in the launcher's context menu; launchers that ignore the optional Actions= key keep the ordinary launch unchanged.

The four static operations drive the frontmost GTK window directly. The static Recent and Attention entries open live in-app GTK palettes because the desktop-entry format cannot publish dynamic session identities or nested runtime submenus.

Cause

packaging/linux/io.github.melonamin.agterm.desktop had no Actions= key or [Desktop Action …] groups. The Linux GApplication also used only G_APPLICATION_HANDLES_OPEN, so an action implemented as Exec=agterm-linux --desktop-action=… had no path to forward that argument from a short-lived secondary process into the live primary instance.

The personal installer had a related packaging trap: its broad sed replacement rewrote every future Exec= line to the bare absolute binary path, which would silently remove every action argument.

Minimal reproduction

  1. Install the current Linux DEB/RPM/Flatpak/AppImage desktop entry, or run scripts/install-linux.sh.
  2. Pin agterm to a launcher that implements freedesktop Desktop Entry Actions, such as Cinnamon's Grouped window list.
  3. Right-click the agterm icon.

Expected (native Linux parity): launcher entries for New Session, New Window, Quick Terminal, Dashboard, Recent Sessions, and Sessions Needing Attention. Actual before this PR: only shell-owned generic items such as pin/unpin and close are present because agterm declares no actions.

Change

Commit feat(linux): add desktop launcher actions:

  • packaging/linux/io.github.melonamin.agterm.desktop — declares six standard Desktop Entry Actions with packaged symbolic icons and explicit --desktop-action=… arguments.
  • Sources/AgtermLinux/LinuxDesktopActions.swift — adds the pure action catalog and command-line classifier. Ordinary activation, multiple path opens, and ---escaped paths retain their existing shapes; unknown or mixed action invocations fail closed.
  • Sources/AgtermLinux/App.swift — enables G_APPLICATION_HANDLES_COMMAND_LINE, forwards every cold/warm invocation to the primary instance, reuses g_application_activate() / g_application_open() for the existing lifecycle, and routes actions to the frontmost AppController.
  • Sources/AgtermLinux/Palette.swift — adds a live MRU palette for the static Recent Sessions launcher entry. Attention reuses the existing ranked attention palette.
  • scripts/install-linux.sh — rewrites every installed launcher Exec= to the absolute personal binary while preserving its action arguments.
  • Tests/AgtermLinuxTests/LinuxDesktopActionsTests.swift — covers all action arguments, ordinary activation/path opening, escaped leading-dash paths, and invalid/mixed invocations.
  • tests/atspi_desktop_actions.py + tests/atspi_smoke.py — parse the packaged desktop entry through GIO and exercise cold New Session plus warm Quick Terminal, Dashboard, Recent, Attention, and New Window delivery against the real single-instance GTK app.
  • README.md — documents launcher support, dynamic-palette adaptation, and the fallback for launchers that ignore actions.

Scope note

Linux launcher integration only. No shared agtermCore behavior, persisted model, keymap syntax, notification policy, terminal protocol, or macOS target changes.

Desktop Entry Actions are intentionally static. This PR does not add Cinnamon/GNOME/KDE-specific extensions for dynamic nested menus; Recent and Attention resolve current state only after entering the app, which keeps the downstream delta portable and reviewable.

Keep-in-sync

Control API exempt: every underlying capability already has its existing GUI/control path (session new, window new, quick, dashboard, tree/status read-back). This PR adds an OS launcher adapter, not a new mutable product capability. Recent and Attention are interactive selection surfaces, matching the existing popover/palette exemption.

The keymap format and window/workspace/session/pane model are unchanged, so the bundled agent skill command catalog needs no update. README.md is updated for the new user-facing launcher surface; CHANGELOG.md remains release-only and is intentionally unchanged.

Testing

All verification ran inside a purpose-built swift:6.3.2-noble Docker image with the CI GTK4/libadwaita, software GL, AT-SPI, Xvfb/Openbox, desktop-file-utils, Zig 0.16.0, and SwiftLint 0.65.0 dependencies. The main checkout and feature worktree were mounted at their original absolute paths so the worktree .git pointer remained valid.

  • Targeted swift test --filter LinuxDesktopActionsTests: 3 tests / 1 suite passed.
  • Targeted real GTK scenario AGTERM_ATSPI_SCENARIO=desktop-actions scripts/test-linux-ui.sh: GIO desktop-entry parse plus cold/warm action routing passed.
  • Shared agtermCore with CI-like 4-CPU parallelism: 2570 tests / 97 suites passed; the OpenCode plugin suite remained dependency-skipped because the CI image has no qualifying Node.js.
  • Linux Swift package: 335 tests / 48 suites passed.
  • swiftlint lint --strict --quiet — clean.
  • swift build and swift build -c release in agterm-linux — succeeded.
  • Full GTK AT-SPI smoke matrix, including the new desktop-actions scenario — PASS.
  • scripts/check-linux-core-boundary.sh, scripts/check-linux-cli-drift.sh, scripts/test-linux-architecture.sh, scripts/test-linux-resources.sh, scripts/test-published-linux-release.sh, and scripts/verify-linux-vendor-cache.sh — passed.
  • scripts/stage-linux.sh — staged the release payload successfully.
  • desktop-file-validate — passed for the source entry, staged package entry, and simulated personal-install entry.
  • Simulated personal install retained the bare primary Exec= plus all 6 absolute-path --desktop-action=… arguments.
  • git diff --check and git diff --check upstream/linux-port...HEAD — clean.

Files (9)

  • README.md
  • agterm-linux/Sources/AgtermLinux/App.swift
  • agterm-linux/Sources/AgtermLinux/LinuxDesktopActions.swift
  • agterm-linux/Sources/AgtermLinux/Palette.swift
  • agterm-linux/Tests/AgtermLinuxTests/LinuxDesktopActionsTests.swift
  • agterm-linux/tests/atspi_desktop_actions.py
  • agterm-linux/tests/atspi_smoke.py
  • packaging/linux/io.github.melonamin.agterm.desktop
  • scripts/install-linux.sh

@MemberIT
MemberIT requested a review from melonamin as a code owner August 28, 2026 15:18
@melonamin
melonamin force-pushed the feat/linux-desktop-actions branch from dc2aae7 to ef0c871 Compare September 3, 2026 02:14
@melonamin
melonamin merged commit ef98d79 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