Repository navigation
Conversation
A link opened from a terminal or a notification comes with an XDG_ACTIVATION_TOKEN that proves a click asked for focus. Both browser launch paths dropped it. The handoff writes straight to the browser's singleton socket, so the running browser never saw the token a browser process would have moved into --xdg-activation-token, and asked for focus with a token of its own instead. The fallback starts the browser in a systemd unit, which takes the user manager's environment and not the caller's. Pass the token as --xdg-activation-token over the socket, and carry it into the unit with --setenv.
[Medium impact] The PR appears safe to merge; no outstanding issues were found. SummaryThe PR carries the caller's activation token through browser launches and fixes Edge's socket message.
Both earlier findings are fixed: the tests clear inherited tokens and skip cases when system flags could change the result. No new issues were found in the latest test change. Reviews (7) · Last reviewed commit: "Run the Edge handoff case where Edge isn..." · Reviewed by Greptile |
GLib only hands a launched app the caller's activation token when the app's entry sets StartupNotify=true. Links opened through the desktop portal's OpenURI, which carries the token as its activation_token option, reached omarchy-launch-browser without it.
|
Reviewed at 3d919ac and nothing found to change. All three paths really did drop the token, and this fixes each one. What ran, on a disposable Omarchy worker (Hyprland 0.56.2, Chromium 154, xdg-desktop-portal 1.22.1, glib2 2.90.1):
Codex Medium gave a second opinion. Its own reading agreed that the problem is real and the change is proportionate, and its independence is not guaranteed. It also checked the order of the singleton arguments, how One thing to note: the description says "Part of #16078", but that number doesn't resolve in this repository, so nothing is linked as fixed. This is waiting on the maintainer. |
|
On Microsoft Edge this makes links that carry a token open a blank tab. Edge drops the first two arguments of any handoff with more than one, so |
Edge's own second process sends two more fields after the working directory on the singleton socket: the time in microseconds since 1601, then a number Edge doesn't check. A message without them is read correctly only when it has a single argument. With more than one, Edge takes the first two arguments as those fields and drops them, so a link handed off with --xdg-activation-token opened a blank tab, as did a web app launched with extra flags. Reported with the fix in omacom#16428.
It re-reads the line the change adds to omarchy-browser.desktop, which AGENTS.md rules out under "Don't restate the implementation". Removing that line from the entry is what the test would catch, and that is an edit to the line itself; the portal behaviour it stands for was checked against a real OpenURI call instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-reviewed at 8a0e4a1 after the Edge commit. The Edge fix works, and I pushed one commit that removes a test. Edge, on a disposable Omarchy worker (Hyprland 0.56.2,
With Edge installed, the new Edge case in Edge itself ignores the token. After every handoff, Edge 156 called Pushed: 8a0e4a1 removes the case in Suite: Second opinion: Codex Medium and muse-spark-1.3 (thinking high) reviewed the Edge commit and then the removal, and found no defect. They checked the 1601-epoch arithmetic with both #16428 is now linked as fixed by this pull request. This is waiting on the maintainer: when to land token plumbing that changes nothing visible until Hyprland checks token serials, and how it is ordered against #14283. |
The handoff leaves any launch to the launcher when /etc/<browser>-flags.conf carries a flag beyond Omarchy's own. The test points XDG_CONFIG_HOME at a temp dir but can't swap out /etc, so on a machine with such a flag the Chromium and Edge cases failed though the handoff did the right thing. Skip them when the system flags file exists.
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
|
Re-reviewed at ea04ea2. The new commit fixes the false failure Greptile pointed out, and nothing else in the pull request changed. On a disposable Omarchy worker with
The handoff and launcher code is the same as at fbcb64c, so the real-Edge reproduction from my last review still stands. With the Edge commit reverted, a link and a web app with an extra flag open a blank tab; at the head they open the URL. Second opinion: Codex Medium and muse-wonder (thinking high) reviewed ea04ea2 and the merge with current A competing fix: #16433 by @vitally makes the same Edge change to This is waiting on the maintainer, as before: when to land token plumbing that changes nothing visible until Hyprland checks token serials, and how it is ordered against #14283. |
The packaged path is what selects Edge's profile, so the test stands in for type -P rather than skipping wherever Edge is missing, which is everywhere the suite usually runs. Taken from omacom#16433. Co-Authored-By: Vitally Tezhe <vitally@tezhe.eu> Co-Authored-By: muse-wonder High <noreply@meta.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-reviewed at 3c8e8c4. I pushed one commit to this branch. It brings over the Edge test improvement from #16433 by @vitally, credited to them with a What it changes: the Edge case now stands in for On a disposable Omarchy worker without Edge installed:
Second opinion: Codex Medium and muse-wonder (thinking high) reviewed the commit and found no defect. They confirmed that the stand-in reaches the handoff and doesn't leak into later cases. I wrapped a long comment at muse-wonder's suggestion. Two other points are not taken. Running the Edge case ahead of the Chromium check isn't needed, because a stock install ships #16433 now has nothing this pull request lacks. This is waiting on the maintainer, as before: when to land token plumbing that changes nothing visible until Hyprland checks token serials, and how it is ordered against #14283. |
Part of #16078.
What changed
A link opened from a terminal or a notification carries an
XDG_ACTIVATION_TOKEN, the compositor's proof that a click asked for focus. Both browser launch paths dropped it:omarchy-cmd-browser-handoffwrites the URL straight to the running browser's singleton socket. A browser process would have moved the token into--xdg-activation-tokenbefore handing off; the handoff didn't, so the running browser asked for focus with a token of its own, made from the last input it received.omarchy-launch-browserstarts a new browser in asystemd-rununit, which takes the user manager's environment, not the caller's.omarchy-browser.desktopdidn't setStartupNotify=true. GLib only hands a launched app the caller's token when it does, so links opened through the desktop portal's OpenURI (which carries the token asactivation_token) reachedomarchy-launch-browserwithout it.Now the handoff passes
--xdg-activation-token=$XDG_ACTIVATION_TOKENwhen the variable is set, the launcher adds--setenv=XDG_ACTIVATION_TOKENto the unit, and the link entry setsStartupNotify=true, with a migration to refresh the installed copy.omarchy-launch-webappstarts its browser with plainuwsm-app, which keeps the caller's environment, so it needs no change.Edge needs one more fix for the token to get through. Its own handoff sends two more fields after the working directory, and when they're missing and there's more than one argument, Edge drops the first two.
--xdg-activation-token=T URLthen opened a blank tab. The handoff now sends Edge those fields, as reported with the fix in #16428. This also fixes Edge web apps launched with extra flags, such as the Sunshine admin app.On Hyprland 0.56.2 this changes nothing visible, since every activation request is granted. It matters once Hyprland checks token serials (hyprwm/Hyprland#16427 and the follow-up in #16078): a real click then raises the browser, and an automated open doesn't.
omarchy-launch-browserstill focuses the browser itself after any URL launch; #14283 removes that for a running browser.How it was verified
test/shell.d/browser-handoff-test.sh: new case checks the token is sent as--xdg-activation-tokenahead of the arguments. Fails without the change.test/shell.d/launch-browser-test.sh: new cases check--setenv=XDG_ACTIVATION_TOKENis passed when a token is set and not otherwise. Fails without the change.OpenURIfor an https URL withactivation_tokenportal-e2e-tokenwent throughomarchy-browser.desktopandomarchy-launch-browser, and the running Brave calledactivate("portal-e2e-token").WAYLAND_DEBUG=1):XDG_ACTIVATION_TOKEN=e2e-token bin/omarchy-cmd-browser-handoff chromium <url>made the running Chromium callactivate("e2e-token").systemd-run --setenv=XDG_ACTIVATION_TOKEN uwsm-app --calledactivate("fresh-start-token").--xdg-activation-token.test/shell.d/browser-handoff-test.sh: new Edge case checks the two extra fields are sent. It runs only where/usr/bin/microsoft-edge-stableis installed and skips otherwise. I ran it with a stand-in binary in a private mount namespace: fails without the fix, passes with it.--xdg-activation-token=T URL,--new-window --profile-directory=Default URL, a bare URL, and--app=URL --ignore-certificate-errors. Without the fix, the first two opened a blank tab. I didn't check whether the window and app-window switches took effect, only that the URL opened.Not run: the full
./test/shellsuite.Fixes #16428