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:
1 parent
8273b6c2d7
commit
fa729f139c
4 files changed
+132
-7
No files matched your search
@@ -3,10 +3,7 @@
|
||||
# omarchy:summary=Launch the default browser as determined by xdg-settings.
|
||||
# omarchy:args=[url]
|
||||
|
||||
default_browser=$(env -u BROWSER xdg-settings get default-web-browser)
|
||||
if [[ -z $default_browser ]]; then
|
||||
default_browser=$(xdg-mime query default x-scheme-handler/https)
|
||||
fi
|
||||
default_browser=$(omarchy-cmd-default-browser)
|
||||
browser_exec=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$default_browser 2>/dev/null | head -1)
|
||||
|
||||
if $browser_exec --help 2>/dev/null | grep -q MOZ_LOG; then
|
||||
|
||||
Reference in new issue
Block a user