Skip to content

fix(linux): give hooks the same PATH as custom commands - #61

Merged
melonamin merged 1 commit into
melonamin:linux-portfrom
alexandru-savinov:upstream/linux-hooks-path
Nov 20, 2026
Merged

melonamin merged 1 commit into
melonamin:linux-portfrom
alexandru-savinov:upstream/linux-hooks-path

Conversation

@alexandru-savinov

Copy link
Copy Markdown

Linux hooks and keymap custom commands look up executables on different PATHs. LinuxHooks builds the hook's PATH with the shared macOS CommandPath.widened, which appends /usr/local/bin and /opt/homebrew/bin. The custom-command runner uses LinuxCommandPath, which also appends ~/.local/bin. With a minimal GUI PATH, a helper installed only in ~/.local/bin is found by a custom command but not by a hook. The hook's shell exits 127 and the hook reports a failure.

Fix: the hook environment is now built in LinuxHookEnvironment.make, which uses LinuxCommandPath as custom commands do. The bundled CLI directory now comes from /proc/self/exe instead of argv[0]. The AGT_* event variables and the GDK environment restore are unchanged.

Test: LinuxHookEnvironmentTests checks that the environment carries the event fields and the custom-command PATH. It also runs a real /bin/sh -c lookup of a helper placed only in an isolated ~/.local/bin. The lookup succeeds with the new PATH. The previous shared PATH exits 127, so the test can fail.

Validation: I ran this branch through the linux-port CI on my fork, with workflow_dispatch added on a separate branch: https://github.com/alexandru-savinov/agterm-omarchy/actions/runs/43308641188. swift test (agterm-linux) passed 636 tests, including the new "Linux hook environment" suite. The GTK build, 72 AT-SPI smoke scenarios, the unit tests and whole-tree strict SwiftLint also passed. The run's SwiftLint job is red only because of the published-release verifier fixture, which expects GITHUB_REPOSITORY=melonamin/agterm-linux and so fails in any fork.

This was prepared with AI assistance (Claude). I reviewed the change. It has not been exercised in a live GTK session with a real hook.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BdkWyAeuohRJ3imTJDuXXs

LinuxHooks built the hook child's PATH with the shared macOS
CommandPath.widened, while keymap custom commands use LinuxCommandPath,
which appends ~/.local/bin. A hook command installed only in
~/.local/bin was therefore found by a custom command but not by a hook.

Move the hook environment assembly into LinuxHookEnvironment and use
LinuxCommandPath there, with the bundled CLI directory resolved from
/proc/self/exe as for custom commands. Event fields and the GDK
environment restore are unchanged.

Tests: the environment carries the event fields and the custom-command
PATH; a real /bin/sh lookup finds a helper placed only in an isolated
~/.local/bin, and the previous shared PATH misses it (exit 127).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BdkWyAeuohRJ3imTJDuXXs
@alexandru-savinov

Copy link
Copy Markdown
Author

Hi @melonamin, a short heads-up rather than a request.

Since linux-port has been quiet since Nov 8, our fork (https://github.com/alexandru-savinov/agterm-omarchy) is going to keep the Linux GUI maintained for Omarchy users:

  • We'll track umputun/agterm releases directly. We're currently on v0.41.1 and catching up to v0.43.0.
  • We'll package it for Omarchy (omacom/omarchy-pkgs) as agterm-omarchy-bin.
  • We keep your app ID (io.github.melonamin.agterm) and binary names, and credit you for the port everywhere it ships.

If you pick linux-port up again, we'd gladly merge your work back and offer our Linux fixes to you as PRs. That includes this one, and the HTML bridge, frame navigation and app-tick fixes. If you'd prefer we change the ID or the naming, just say so and we will.

(Prepared with Claude Code; reviewed and posted by me.)

@melonamin
melonamin merged commit e876da4 into melonamin:linux-port Nov 20, 2026
@alexandru-savinov
alexandru-savinov deleted the upstream/linux-hooks-path branch November 20, 2026 19:09
@alexandru-savinov

Copy link
Copy Markdown
Author

Follow-up to my note above: the Omarchy package request is now up (omacom/omarchy-pkgs#3184, draft PR omacom/omarchy-pkgs#3268). As promised, it ships as agterm-omarchy-bin, keeps your app ID (io.github.melonamin.agterm) and binary names, and credits you for the port. Same offer as before: if you'd like the ID or naming changed, say so and we will.

Prepared and posted with AI assistance (Claude Code) on my behalf.

@alexandru-savinov

Copy link
Copy Markdown
Author

Hi @melonamin, following up on my earlier offer here to send our general Linux fixes back as PRs.

These three are merged in agterm-omarchy and all are in release 0.43.0.13. Tell me which you'd like, and I'll open one PR per fix against linux-port:

  • Mesa 26.3.1 GL (#489): retries GTK's failed EGL window-config request, so the terminal keeps GL on Mesa 26.3.1 (GNOME/gtk#8566).
  • HTML-overlay paste (#503): on X11 a keyboard paste waits briefly for the clipboard's formats, on Wayland an unresolved offer is blocked, and both refuse mixed file and text offers.
  • Terminal launcher arguments (#531): accepts -e, --working-directory=, --title= and --app-id=, and the desktop entry advertises them to xdg-terminal-exec.

No pressure. If none of them fit linux-port, that's fine too.

Prepared and posted with AI assistance (Claude Code) on my behalf.

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