Files
dotfiles/dot_local/bin/executable_omarchy-launch-browser

20 lines
1001 B
Bash
Executable File

#!/bin/bash
# omarchy:summary=Launch the default browser; a cold Brave Origin start reopens the last session without the "Restore pages?" prompt.
# omarchy:args=[url]
# Shadows /usr/bin/omarchy-launch-browser (~/.local/bin is earlier on PATH)
# and hands off to it. A reboot or power-off kills Brave uncleanly, so the
# next start counts as post-crash: Chromium then skips session restore and
# shows the "Restore pages?" bubble instead. --hide-crash-restore-bubble
# clears that post-crash state, and --restore-last-session reopens every
# window. Added only on a cold, non-private start: a running browser ignores
# both, and Omarchy's launcher would read the first flag as the URL to focus.
if [[ " $* " != *" --private "* ]] &&
[[ $(env -u BROWSER xdg-settings get default-web-browser) == brave-origin.desktop ]] &&
! pgrep -f '^/opt/brave-origin-bin/brave( |$)' >/dev/null; then
set -- --restore-last-session --hide-crash-restore-bubble "$@"
fi
exec /usr/bin/omarchy-launch-browser "$@"