* Hand browser and web app launches to the running browser directly With a Chromium-based browser already running, each launch started a second browser process only to pass its command line over the profile's singleton socket and exit, ~165ms before the running browser even heard of it. omarchy-cmd-browser-handoff sends that message itself with socat and waits for the ACK, so a web app opens in ~210ms instead of ~430ms. It hands off only what it can do exactly as the browser would: the packaged browser binary rather than a wrapper, a flags file holding nothing beyond the process flags Omarchy ships, no other data directory, and a socket we own. Anything else, or no answer, launches the browser as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Hand Brave Origin launches to the running browser too /usr/bin/brave-origin is the package's own launcher, reading brave-origin-flags.conf, with the profile in BraveSoftware/Brave-Origin. A web app now opens in ~158ms instead of ~345ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.0 KiB
Bash
Executable File
34 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Launch the default browser as determined by xdg-settings.
|
|
# omarchy:args=[url]
|
|
|
|
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
|
|
private_flag="--private-window"
|
|
elif [[ $browser_exec =~ edge ]]; then
|
|
private_flag="--inprivate"
|
|
else
|
|
private_flag="--incognito"
|
|
fi
|
|
|
|
if ! omarchy-cmd-browser-handoff "$browser_exec" "${@/--private/$private_flag}"; then
|
|
systemd-run --user --quiet --collect --unit="omarchy-browser-$(date +%s%N)" \
|
|
--property=StandardOutput=null --property=StandardError=null \
|
|
uwsm-app -- "$browser_exec" "${@/--private/$private_flag}"
|
|
fi
|
|
|
|
url=""
|
|
for argument in "$@"; do
|
|
if [[ $argument != "--private" ]]; then
|
|
url=$argument
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [[ -n $url && -n ${HYPRLAND_INSTANCE_SIGNATURE:-} ]]; then
|
|
omarchy-hyprland-focus-app "^$(basename "$browser_exec" -stable).*$" || true
|
|
fi
|