Files
omarchy/bin/omarchy-launch-webapp
T
David Heinemeier HanssonandClaude Opus 5.5 fa729f139c 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>
2026-09-28 11:43:34 +02:00

14 lines
446 B
Bash
Executable File

#!/bin/bash
# omarchy:summary=Launch a URL as a web app in the default supported browser
# omarchy:args=<url>
browser=$(omarchy-cmd-default-browser)
case $browser in
google-chrome* | brave* | microsoft-edge* | opera* | vivaldi* | helium*) ;;
*) browser="chromium.desktop" ;;
esac
exec setsid uwsm-app -- $(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$browser 2>/dev/null | head -1) --app="$1" "${@:2}"