Repository navigation
Route links from every app through the running default browser - #14441
Conversation
|
|
This fixes a long-standing annoyance. Two small things:
|
|
@jandrusk Thanks! Flatpak is out of scope for Omarchy, so wrapper Exec lines aren't something this needs to handle. They fail safely anyway: On stale copies: Posted by Claude on behalf of DHH |
8f459d6 to
6964bb6
Compare
A browser hands a new tab to the window that was focused last, so that is the one to bring forward. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Electron apps open links through the desktop portal, which runs the default browser's desktop entry without an activation token, so the window that took the tab stays out of sight. A Hyprland-specific mimeapps list now points http and https at omarchy-browser.desktop, which opens them through omarchy-launch-browser to hand them over and focus the window. The browser itself stays in mimeapps.list, where xdg-settings and the browsers keep it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Links reach the browser through omarchy-browser.desktop, so the browser's own check finds another handler in front of it and asks to be made the default. Chromium-family browsers skip that check with --no-default-browser-check, which the hand-off accepts as one of Omarchy's own flags, and a managed DefaultBrowserSettingEnabled=false policy hides the button that would rewrite mimeapps.list behind Omarchy's back. Firefox and Zen get the DontCheckDefaultBrowser policy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Focus the matching window used last when several match A browser hands a new tab to the window that was focused last, so that is the one to bring forward. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Route links from every app through the running default browser Electron apps open links through the desktop portal, which runs the default browser's desktop entry without an activation token, so the window that took the tab stays out of sight. A Hyprland-specific mimeapps list now points http and https at omarchy-browser.desktop, which opens them through omarchy-launch-browser to hand them over and focus the window. The browser itself stays in mimeapps.list, where xdg-settings and the browsers keep it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Stop browsers asking to be the default behind the link routing Links reach the browser through omarchy-browser.desktop, so the browser's own check finds another handler in front of it and asks to be made the default. Chromium-family browsers skip that check with --no-default-browser-check, which the hand-off accepts as one of Omarchy's own flags, and a managed DefaultBrowserSettingEnabled=false policy hides the button that would rewrite mimeapps.list behind Omarchy's back. Firefox and Zen get the DontCheckDefaultBrowser policy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 9f49906)
quattro added DontCheckDefaultBrowser to default/firefox/policies.json so Firefox-based browsers stop asking to be the default behind Omarchy's link routing (omacom#14441). zen-policies.json was copied from the stock file before that, so Zen would still ask. Add the key, and test that Zen's file carries every policy the stock one does so the two cannot drift again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mimeapps.list case in default-apps-test covered what omacom#14441 already landed, and default-browser-lookup-test covers that lookup. Assert the X-Generic fallback there instead, where the environment is already isolated, and leave default-apps-test as it is on quattro. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clicking a link in foot brings up the browser window that got the tab. Clicking one in Signal doesn't: the tab lands in a Chromium window somewhere out of sight.
Why they differ. foot runs
xdg-open URLwith a Wayland activation token. Chromium forwards the token to the running instance, and Hyprland (focus_on_activate = true) brings forward the window that took the tab. Electron apps (Signal, and others) send links through the desktop portal (org.freedesktop.portal.OpenURI) instead. They pass no activation token, soxdg-desktop-portalruns the default browser's desktop entry without one, and nothing is focused.Fix. A static, hidden
omarchy-browser.desktoprunsomarchy-launch-browser %U, which hands the link to the running browser and focuses its window.~/.config/hyprland-mimeapps.listpointsx-scheme-handler/httpandhttpsat it. GIO (the portal's lookup) andxdg-mime(xdg-open's) read that desktop-specific list beforemimeapps.list, so both paths end up there.The browser itself stays in
mimeapps.list, untouched. Nothing is copied or generated, so nothing needs refreshing when the browser package updates or the default changes:omarchy-cmd-default-browserskipsomarchy-browser.desktopand returns the browser behind it. Itsxdg-settingsandxdg-mimefallbacks run withXDG_CURRENT_DESKTOP=so they never return the routing entry, which would launch itself.xdg-settings set default-web-browsercalls also run withXDG_CURRENT_DESKTOP=. Otherwisexdg-settingsreads its write back through the desktop-specific list, seesomarchy-browser.desktop, and writes the old value back.Default browser check. With the routing entry in front, browsers think they aren't the default and ask.
--no-default-browser-checkgoes into the shipped Chromium flags and, through a migration, into existing Chromium, Chrome, Edge, Brave and Brave Origin flags files.omarchy-cmd-browser-handoffaccepts it as one of Omarchy's own flags. A managedDefaultBrowserSettingEnabled=falsepolicy (omarchy.json, installed wherever Omarchy sets up a Chromium-family policy directory, and by the migration into existing hardened ones) also hides the "Make default" button. That button would otherwise runxdg-settingsinside the session and fail on the same read-back. Firefox and Zen get theDontCheckDefaultBrowserpolicy. On existing installs it is merged intopolicies.json, keeping anything an administrator added there.Focus.
omarchy-hyprland-focus-appnow picks the matching window focused last (focusHistoryID) instead of the first one listed. With several Chromium windows, that is the one Chromium gives the new tab to.Tests. New
browser-link-handoff-test.sh:xdg-mimeand GIO route links to the entry.omarchy default browsersets and reads back the browser behind it.New
default-browser-check-migration-test.shcovers the flag migration (including symlinked flags files), the shipped defaults, and that the migration writes only Omarchy's own policy files as root.browser-policy-dir-test.shchecks that policy setup installs the new policy.browser-handoff-test.shalready copies the shipped flags file, so it covers the allowlist.hyprland-focus-app-test.shgains a most-recent-window case. The shell suite fails the same 2 files as unchangedquattro(openclaw-cli, passwordless-grant-lifecycle)../test/clipasses. The migration's root policy writes weren't run here (no passwordless sudo, no Firefox).Checked live through
org.freedesktop.portal.OpenURIover D-Bus, the way Electron calls it:hyprland-mimeapps.listset aside, the same call left focus on foot. That is the original bug.omarchy default browser chromiumsucceeds inside the session and leavesmimeapps.listnaming Chromium.🤖 Generated with Claude Code
Posted by Claude on behalf of DHH