Repository navigation
Conversation
Omarchy sets misc:focus_on_activate globally, so a running single-instance browser that is handed a URL by another process activates the window that owns the session and the view jumps to whichever workspace that window lives on. Telegram already opts out per app; do the same for both browser families. A new shell test loads the app rules with a stub hl and asserts both families decline activation requests. Refs omacom#14282
[Medium impact] The PR appears safe to merge with the stated notification-click tradeoff. SummaryStops browser activation requests from taking focus and skips explicit focus after a successful URL handoff.
Reviews (5) · Last reviewed commit: "test: drop the browser rule config test" · Reviewed by Greptile |
|
Especially good when you have an AI agent opening up chrome browser tabs while you are off on a different workspace doing something else. |
chessing234
left a comment
There was a problem hiding this comment.
Reviewed head 95800c790cc2c4c8f4408b5ea2e4d340596a5c7c.
Reviewed both browser-family rules and their interaction with the tag rules. The Lua rule test passed with a stub compositor API. This disables browser activation requests; the separate explicit focus in omarchy-launch-browser remains outside this rule. No new rule defect found. A live browser/link-opening session was not exercised.
|
Thanks for this. Stopping a link handoff from yanking the workspace is a real improvement. I think there are two things to sort out before it lands, though:
|
…anded-off URL Review follow-up on omacom#14283: - The unanchored Chromium pattern also catches an Omarchy web app's window class (chrome-<host>_<path>-Default, omarchy-webapp-window-class). Clicking such a web app's notification runs the notification's default action, and the shell only falls back to raising the sender by class when nothing was invoked (shell/plugins/notifications/Service.qml) -- so an opt-out covering those classes makes the click do nothing visible. Name the browser classes instead, with the release suffixes they ship under (chromium-browser on the same machine as chromium, google-chrome-stable/-beta/-dev/-unstable). The tag patterns stay unscoped, because apps/pip.lua and the video rules key off them for web apps. - omarchy-launch-browser focused the browser for any launch that carried a URL, which is the handoff path a link click takes when the browser is already running: focusing there defeats the opt-out. Focus only a browser this launcher started. Tests: test/shell.d/hyprland-browser-focus-test.sh (4 ok) and test/shell.d/launch-browser-test.sh (3 ok, incl. the new handoff case).
|
Both points addressed in 1. Web apps and their notification clicks. You are right that the Chromium pattern was unanchored — it matched The suffixes are the names the Chromium releases actually ship under — a live session here has both The tag patterns stay unscoped on purpose: 2. Which entry points this actually fixes.
Tests. I could not exercise a real notification click on a web app — the web apps on this machine carry custom Also checked the merge against current |
…t-out The anchored opt-out named the classes the stable packages report, but Brave and Edge ship every channel as its own package with its own window class (brave-browser-beta, microsoft-edge-dev, ...). The family tag catches those windows, so the opt-out has to as well -- otherwise a link handed to a running Beta still asks to be focused and drags the view to its workspace, which is the behaviour this rule exists to stop. Vivaldi's snapshot builds are the same case. The test now also proves it reads the value rather than the key: a rule that opts back in is asserted not to count as an opt-out. The previous `focus_on_activate ~= nil` classification would have called that rule an opt-out and let a `true` value pass.
…e-browsers # Conflicts: # test/shell.d/launch-browser-test.sh
|
Both review points are now actually covered, and the branch is merged up to Channel builds opt out too ( The test reads the value, not the key (second hunk of Merged up to Verification on the merged head:
|
|
@CaffeinatedTech's comment above describes the agent case, a browser opening tabs while you work on another workspace. On Hyprland 0.56.2 I found that with the option off, new windows and |
|
Thanks — that matches the split in the code. This PR only sets Two details that keep the two rules from overlapping, for the record:
I have not reproduced the new-window / Head |
|
This also blocks notification clicks from the browser itself, not only from web apps. Teams, Slack and other web clients send notifications from a service worker. On click the shell invokes the Quickshell never sent the activation token those requests need, so this path was already broken. omacom/omarchy-pkgs#1367 patches quickshell to send it. With that build, clicking a real Teams notification in Brave from another workspace switches to the Teams window that sent it, even with two Teams windows open. With Could the link-handoff jump be fixed without turning off activation for the whole browser class? |
Clicking a Teams or Slack toast from a browser tab runs the notification's default action, and the window is raised only by the browser's activation request, which this rule suppresses. No per-window switch separates that request from the URL handoff the rule exists to stop, so name the lane that gives the click its raise back (omacom#7738) in the rule's own comment.
|
You are right, and it is not limited to web apps — the browser's own notifications sit on the same switch.
Could the handoff jump be fixed without turning activation off for the whole class? Not with a window rule. The URL handoff and the notification click are both an xdg-activation request from the same client — the repro in this body jumps from a bare What each half actually buys:
The lane that composes with it is #7738: focus the window the activation request named instead of relying on I have written that cost into the rule's own comment (973cee8) rather than leave the file claiming the web-app case is the only one, and the PR body now carries the same paragraph. I would rather not land this as a silent regression against omarchy-pkgs#1367, so which way do you and the maintainers want it:
Head is |
|
Thanks. I tested this with a port of #7738 and it works: links stay put, notification clicks jump to the right window. While testing I found that Wayland activation tokens can tell a real click from an automated open, and that Omarchy and Hyprland currently drop or ignore that signal. Hyprland already merged part of a fix (hyprwm/Hyprland#16427, unreleased). I'm finishing a few tests and will open a discussion with the full picture soon. It may replace the browser rule here, so it might be worth holding off on further changes until then. |
|
Thank you — that is the measurement I could not make here (no service-worker client on this box), and it changes what this PR should be. Holding as you suggest: no new commits, head stays at So the discussion starts from the branch rather than from my summary:
If the token approach replaces the rule, say the word and I will reduce this PR to the launcher change plus its test (or close it and fold everything into the discussion's patch, if that is cleaner for the maintainers). A ping when the discussion is up would be enough; I will not push to this branch before then. |
|
Full write-up with test results and the proposed fixes: #16078 |
|
Read the write-up in #16078 — thank you, that is the picture I could not assemble here. No commits from my side: head stays Item 5 is exactly what this branch can give you. The rule is here today, and once Hyprland ships the stricter serial check (#16606) it comes out cleanly — dropping it would be a two-line revert (the two Two notes. #15661's "the
That agrees with your live measurement (requests denied, windows marked urgent). The remaining weakness on my side is unchanged: our test pins rule registration, so the behavioural evidence is yours, not mine. If the rule does turn out inert on some build, this PR collapses to the launcher half and #14282 goes back to open — say the word and I will cut it. Overlap with #16079. It touches |
|
Correction to the link above: the Hyprland side is hyprwm/Hyprland#16608 (#16606 was closed for using the wrong form). Omarchy carries the patch in omacom/omarchy-pkgs#1379 meanwhile, so the browser rule here can come out once #1379, #16097 and omacom/omarchy-pkgs#1367 ship. Status and merge order: #16078 (comment) |
|
Thanks — corrected in my notes, and the gate you name is still closed, so nothing changes on the branch: head stays at Checked on the public side just now:
So the rule stays in this PR as the interim measure until #1367, #16097 and #1379 all ship. When they do it comes out exactly as described earlier: the two One thing about the corrected link, so readers of #16078 do not hit it: On ordering: agreed that #16079 should go first if it is ready. Ping me when it lands and I will merge Branch still reads MERGEABLE against |
|
#16608 is a discussion, not an issue, so To look it up from the CLI: |
|
Right — my 404 read was wrong. Confirmed from the CLI with the GraphQL form you gave: So the reference in the write-up resolves exactly as written and needs no change; I have corrected my own note to say discussion, not PR, and will use Gate re-checked just now, unchanged, so nothing to do on this branch: Head stays |
…e-browsers Conflict: apps/browser.lua's chromium tag rule. Upstream moved that literal pattern into o.chromium_browsers (default/hypr/helpers.lua), so the tag rule now takes the helper and this branch's comment above it stays as written -- the helper is the same unscoped pattern, which is what the tag rule needs. The launcher test also needed a rebase-shaped update: upstream's omarchy-launch-browser now resolves Exec= through omarchy-cmd-default-browser and exits 1 when nothing resolves, so the handoff case has to keep $ROOT/bin on PATH like its sibling cases or it aborts before the assertion runs.
|
Merged What the merge needed:
Verified at |
AGENTS.md asks for no test of a small declarative change, and for extending an area's existing test file rather than adding a new *-test.sh. The two focus_on_activate rules are config values, so the standalone file goes; the launcher case in launch-browser-test.sh stays, because it covers the branch that decides whether a handed-off URL is focused. Refs omacom#14283
|
Took the P2 on the config test — removed it in You are right that What is left, and why:
This also makes the earlier P2 about Diff against |
|
Merged
|
What
Both browser families stop accepting activation requests, the way Telegram already does (
default/hypr/apps/telegram.lua):The property sits on its own class rule rather than the tagging one, so the opt-out can name the classes the browsers actually report (Chromium,
chromium-browser, Chrome's-stable/-beta/-dev/-unstable, Brave's-beta/-dev/-nightly, Edge's-beta/-dev, Vivaldi's-snapshot) while the family tags keep their unscoped patterns —apps/pip.luaand the video rules key off those tags for web apps, and an Omarchy web app's class (chrome-<host>_<path>-Default) spells none of the browser names, so web apps keep their activation requests.bin/omarchy-launch-browseralso stops focusing a browser it handed a URL to; only a browser the launcher started itself is focused.Why
Omarchy turns
misc:focus_on_activateon globally (default/hypr/looknfeel.lua:111) while Hyprland defaults it off, so any client that asks to be focused gets the keyboard and the active workspace moves to wherever its window lives. For a single-instance browser handed a URL by another process that is not what the user asked for:The link still opens in the browser window that owns the session; the view just stays where the user is. Background is #14282.
Known cost: browser-sent notification clicks
The global default stays untouched, but this opt-out is not free. Clicking a Teams or Slack toast that a browser tab sent runs the notification's
defaultaction, and the only thing that raises the window is the browser's own activation request — which this rule suppresses.shell/plugins/notifications/Service.qmlonly falls back to focusing the sender by class when no action was invoked, so such a click would close the toast and nothing else would come up.A per-window rule cannot separate that request from the URL handoff this PR exists to stop: both are the same client asking to be raised, so the opt-out is either on or off for the class. The lane that gives the click its raise back is #7738 — focus the window the request named instead of relying on
misc:focus_on_activate. Until that lands, this rule trades a notification click that does not raise for a URL handoff that does not jump; the rule's comment says so explicitly.Tests
test/shell.d/hyprland-browser-focus-test.shloads the app rules with a stubhland asserts, per emitted rule, that every browser class is opted out, that the Chromium web-app class is not, and that afocus_on_activate = trueprobe is not counted as an opt-out: 5 ok.test/shell.d/launch-browser-test.shcovers the launcher, including the handoff case withHYPRLAND_INSTANCE_SIGNATUREset, and asserts nothing is focused: 5 ok. Both run with the repo'sbinonPATH.quattrobefore the change (new test file run against492b8837):not ok - the browser rules opt out of activation requestsluac -p default/hypr/apps/browser.luacleanhyprctl evalon Hyprland0.56.2: accepted,hyprctl configerrorsempty, focused window and client list unchangedbash test/shell: 382 of 399 files pass; the 17 failing ones fail identically on a cleanupstream/quattrocheckout in this environment and none touch this PR's filesStatus
Held at
973cee8until the direction is settled. The measurement this PR cannot make from here — a notification click raised by the browser itself — is in the write-up in #16078, which proposes letting activation-token serials decide instead of per-app rules, once Hyprland accepts them (hyprwm/Hyprland#16606, unreleased). Agreed with @dmkenney: the browser rule stays while it is the only thing that stops the handoff jump, and comes out as a two-line revert once the token check ships; the launcher half stands alone either way.#16079 passes the activation token through the same two launch paths this PR touches. The hunks are independent (
--setenv=XDG_ACTIVATION_TOKENon thesystemd-rununit vs. thestarted_browserfocus guard), so either order merges mechanically.Note on #15661: the
focus_on_activatewindow rule is not inert on the released compositor — in thev0.56.2tag it is a recognised rule effect (WindowRuleEffectContainer.cpp:46) that overrides the globalmisc:focus_on_activateper window (Window.cpp:1375). Reasoning in my comment there.Disclosure: this patch was prepared with an AI coding agent (Hermes) at my direction; I reviewed the diff and ran the checks above myself.