Read the default browser from mimeapps.list when launching (#13520)

* Read the default browser from mimeapps.list when launching

omarchy-launch-browser and omarchy-launch-webapp asked xdg-settings for the
default browser on every launch, ~72ms through several POSIX shell scripts.
The new omarchy-cmd-default-browser reads the http handler from the
config-dir mimeapps.list files the way xdg-mime does, desktop-specific list
first, taking the first listed entry whose command is installed, in ~10ms.
With nothing set there it falls back to xdg-settings as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Let the first copy of a browser entry decide whether it is installed

A user-local entry whose browser is gone could be rescued by a system copy
of the same ID, which the launchers never read. xdg-mime judges the first
copy found, as the launchers use it, so do the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier HanssonandClaude Opus 5.5 authored and GitHub committed 2026-09-28 11:43:34 +02:00
1 parent 8273b6c2d7
commit fa729f139c
4 files changed
+132 -7

No files matched your search

+1 -3
View File
@@ -3,9 +3,7 @@
# omarchy:summary=Launch a URL as a web app in the default supported browser
# omarchy:args=<url>
# The session sets BROWSER to omarchy-launch-browser, which sends xdg-settings
# down a slower path (~100ms against ~30ms) to the same answer.
browser=$(env -u BROWSER xdg-settings get default-web-browser)
browser=$(omarchy-cmd-default-browser)
case $browser in
google-chrome* | brave* | microsoft-edge* | opera* | vivaldi* | helium*) ;;