omarchy-launch-browser silently fails when the default browser's Exec= is wrapped (env, flatpak, ...)
System details
omarchy version 4.0.3-1
What's wrong?
What happened
Setting a .desktop-based default web browser whose Exec= line is wrapped
in another command (e.g. Exec=/usr/bin/env python3 script.py %u, or a
Flatpak's Exec=/usr/bin/flatpak run org.example.App %u) makes every
Omarchy keybinding that opens "the browser" (SUPER+SHIFT+RETURN,
SUPER+SHIFT+B, SUPER+SHIFT+ALT+B, and anything else routed through
omarchy-launch-browser) silently do nothing. No error, no notification —
the shortcut just appears dead.
Why
omarchy-launch-browser extracts the executable from the default browser's
.desktop entry with:
browser_exec=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$default_browser 2>/dev/null | head -1)
This only captures the first whitespace-separated token after Exec=. For
a normal browser (Exec=firefox %u) that's correct. But when the entry is
wrapped, it captures the wrapper with no arguments:
- Exec=/usr/bin/env python3 .../app.py %u → captures /usr/bin/env
- Exec=/usr/bin/flatpak run org.example.App %u → captures /usr/bin/flatpak
The script then runs that bare command via:
systemd-run --user --quiet --collect --unit="omarchy-browser-$(date +%s%N)" \
--property=StandardOutput=null --property=StandardError=null \
uwsm-app -- "$browser_exec" "${@/--private/$private_flag}"
env with no arguments just prints the environment and exits; flatpak
with no subcommand prints usage. Neither opens a window, and because
stdout/stderr are redirected to /dev/null, there's no visible sign of
failure anywhere.
Steps to reproduce
1. Install any app registered as a web browser (x-scheme-handler/https +
Categories=...WebBrowser...) whose .desktop Exec= line starts with a
wrapper, e.g.:
Exec=/usr/bin/env python3 /path/to/script.py %u
2. xdg-settings set default-web-browser <that-app>.desktop
3. Press SUPER+SHIFT+RETURN (or run omarchy-launch-browser directly).
4. Nothing happens. journalctl --user -u 'omarchy-browser-*' shows the
transient unit ran and exited 0 — it just ran env/flatpak with no args.
Minimal repro without installing anything, once a wrapped app is the
default:
env -u BROWSER xdg-settings get default-web-browser
sed -n 's/^Exec=\([^ ]*\).*/\1/p' ~/.local/share/applications/<id>.desktop
# prints "/usr/bin/env" (or "/usr/bin/flatpak") instead of the real app
Expected
omarchy-launch-browser should run the full Exec= command (minus the
%u/%U field code, with the URL substituted or appended), not just its
first token — the same way gtk-launch <desktop-id> <url> or
gio launch <file>.desktop <url> would handle it correctly, since both
resolve the whole Exec line rather than re-parsing it by hand.
System
- Omarchy version: 4.0.3-1
- Script: /usr/share/omarchy/bin/omarchy-launch-browser
- Triggered via the default keybindings (SUPER+SHIFT+RETURN / SUPER+SHIFT+B
/ SUPER+SHIFT+ALT+B), which call omarchy-launch-browser through the
{ omarchy = "browser" } binding helper.
Happy to test a fix — this reproduces reliably with any env- or
flatpak-wrapped default browser entry.
## Related
Same underlying bug as #10988 (`omarchy-launch-webapp`), just in the sibling
script `bin/omarchy-launch-browser` — both use the same
`sed -n 's/^Exec=\([^ ]*\).*/\1/p'` pattern to extract the browser binary from
a `.desktop` Exec= line, and both break the same way on any wrapped Exec
(`env ...`, `flatpak run ...`). Might be worth fixing both call sites with the
same approach.
Confirmed on current quattro, and a fix is up as #15077.
The cause is the one you identified. bin/omarchy-launch-browser keeps only the first word of the default browser's Exec=, so a wrapped entry runs as a bare env <url> or flatpak <url>. bin/omarchy-launch-webapp does the same, which is #10988.
I reproduced it on a disposable VM built from the Omarchy ISO, with Exec=/usr/bin/env OMARCHY_ISSUE=11718 chromium --user-data-dir=/tmp/... %U set as the default browser. On quattro, the launcher ran uwsm-app -- /usr/bin/env https://example.com/, the transient unit exited 127, and no window appeared. With #15077, the same launch opened Chromium on the page, and --private opened an incognito window through the wrapper.
#15077 runs the whole Exec= line in both launchers. It puts the URL where the entry's %u/%U is, which keeps a Flatpak's URL between its @@u … @@ markers, and only hands an entry with no arguments of its own to the already-running browser. Regression tests cover env and Flatpak-style entries for both scripts; they fail on quattro and pass with the fix. Two limits remain, and both behave as they did before: a wrapped Firefox still gets --incognito rather than --private-window for private windows, and a wrapped browser's window isn't brought to the front when it opens a link.
Codex at medium effort reviewed the diagnosis and the fix as a second opinion. Its first round found real gaps that are now fixed in #15077: the hand-off dropping an entry's own flags, %% handling, [Desktop Action] lines, and tests that couldn't tell argument boundaries apart. A second round on the revised fix found nothing further.
This now waits on the maintainer to review #15077. If you'd like to try it with your entry, the branch is fix/issue-11718.
Small cross-link for the maintainers: there are two open PRs for this. #12533 (@paulogeyer, older) also parses the full Exec= line into argv for both omarchy-launch-browser and omarchy-launch-webapp. #15077 does the same with %u/%U placement and Flatpak @@u handling. One should be picked and the other closed. #10988 is the webapp half of the same bug.
A correction to my earlier comment: #12533 by @paulogeyer fixes this too, and it was opened before #15077. My comment named only #15077.
I read #12533 at 3ee5c237 against this report. It runs the whole Exec= line in both launchers, so an env-wrapped entry starts the browser with the URL rather than running env <url>. A Flatpak entry runs as flatpak run … @@u @@ <url>, which still opens the page. It carries verified from a reproduction on a disposable Omarchy worker, and it merges cleanly into quattro. #15077 now conflicts with quattro.
Codex Medium checked both pull requests against this issue as a second opinion. It agreed that both fix the reported cause, and it found that neither is clearly better. For a private window, #12533 finds the browser behind env, so a wrapped Firefox gets --private-window. #15077 probes env instead. #15077 keeps the URL inside a Flatpak's @@u … @@ markers, so a file:// link still goes through the portal. #12533 appends the URL after the markers. Its independence is not guaranteed. Our rule is that the older fix wins unless a newer one is clearly better, so #12533 is the one to take, and #15077's Flatpak handling could be folded into it.
Both pull requests close this issue and #10988. Choosing between them is the maintainer's decision, and this issue waits on that.
Checked all three candidate fixes against a Flatpak default browser. None cover it. Cause is separate from the Exec= parse.
Omarchy 4.0.6-1, Hyprland 0.56.2, Flatpak Vivaldi 8.2.4133.94 (com.vivaldi.Vivaldi):
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=vivaldi --file-forwarding com.vivaldi.Vivaldi @@u %U @@ --use-gl=egl --disable-features=VaapiVideoDecoder
Ran each head's bin/omarchy-launch-webapp in a live session (not a VM) with https://example.com:
| PR | head | result |
|---|---|---|
| #12533 | 6589416 |
exit 1, no window |
| #15077 | d90d476 |
Error: Command not found: "" |
| #13241 | a382a8d |
type: --: invalid option, then Error: Path "--app=https:/example.com" does not exist! |
#12533 under bash -x stops before its new parsing:
+ case $browser in
+ browser=chromium.desktop
+ desktop_exec_argv chromium.desktop
+ return 1
quattro gates on the desktop id before reading Exec=. A Flatpak id is reverse-DNS (com.vivaldi.Vivaldi, app.zen_browser.zen), so it becomes chromium.desktop and the new parsing never runs:
browser=$(omarchy-cmd-default-browser)
+app_id=${browser%.desktop}
+if ! flatpak info "$app_id" >/dev/null 2>&1; then
case $browser in
google-chrome* | brave* | microsoft-edge* | opera* | vivaldi* | helium*) ;;
*) browser="chromium.desktop" ;;
esac
+fi
Webapp only. omarchy-launch-browser has no gate, which is why the Zen/Flatpak case (#16179) reaches the parse and these PRs fix it. So #11718 is covered for the browser, #10988 is not.
With the gate open the rest works: the argv #12533/#13241 produce (... @@u @@ ... --app=https://example.net) opens a real app window, WM_CLASS vivaldi-example.net__-Default. --app= inside the @@u ... @@ block (as #15077 places %U) also opens one. Placement does not decide the webapp case, the gate does.
No patch offered. I can re-run the chosen branch here.