Ensure that $BROWSER runs omarchy-launch-browser and doesn't hand ownership to parent process

This prevents gh auth login from working without an existing open
browser
This commit is contained in:
David Heinemeier Hansson
2026-05-15 16:07:35 +02:00
parent daf301c416
commit 43134875b5
3 changed files with 18 additions and 2 deletions
+4 -2
View File
@@ -6,7 +6,7 @@
default_browser=$(xdg-settings get default-web-browser) default_browser=$(xdg-settings get default-web-browser)
browser_exec=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$default_browser 2>/dev/null | head -1) 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 | grep -q MOZ_LOG; then if $browser_exec --help 2>/dev/null | grep -q MOZ_LOG; then
private_flag="--private-window" private_flag="--private-window"
elif [[ $browser_exec =~ edge ]]; then elif [[ $browser_exec =~ edge ]]; then
private_flag="--inprivate" private_flag="--inprivate"
@@ -14,4 +14,6 @@ else
private_flag="--incognito" private_flag="--incognito"
fi fi
exec setsid uwsm-app -- "$browser_exec" "${@/--private/$private_flag}" systemd-run --user --quiet --collect --unit="omarchy-browser-$(date +%s%N)" \
--property=StandardOutput=null --property=StandardError=null \
uwsm-app -- "$browser_exec" "${@/--private/$private_flag}"
+3
View File
@@ -3,6 +3,9 @@
# Install other terminals via Install > Terminal # Install other terminals via Install > Terminal
export TERMINAL=xdg-terminal-exec export TERMINAL=xdg-terminal-exec
# Used by terminal programs (like gh) to open URLs detached from the terminal process tree
export BROWSER=omarchy-launch-browser
# Use code for VSCode # Use code for VSCode
export EDITOR=nvim export EDITOR=nvim
+11
View File
@@ -0,0 +1,11 @@
echo "Set BROWSER to Omarchy browser launcher for detached terminal URL opens"
if [[ -f ~/.config/uwsm/default ]]; then
if grep -q '^export BROWSER=' ~/.config/uwsm/default; then
sed -i 's|^export BROWSER=.*|export BROWSER=omarchy-launch-browser|' ~/.config/uwsm/default
else
printf '\n# Used by terminal programs (like gh) to open URLs detached from the terminal process tree\nexport BROWSER=omarchy-launch-browser\n' >> ~/.config/uwsm/default
fi
else
omarchy-refresh-config uwsm/default
fi