Scope BROWSER to interactive shells so xdg-settings can change the default browser (#6616)
Exporting BROWSER=omarchy-launch-browser into the whole uwsm session made xdg-settings refuse "set default-web-browser", which broke every browser's own "Set as default" button. The export only exists for terminal programs (like gh) to open URLs detached from the terminal process tree, so move it to default/bash/envs where interactive shells still pick it up. Fixes #6590 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
f76d058a6d
commit
0b24b844df
@@ -1,6 +1,11 @@
|
||||
# Editor used by CLI
|
||||
export EDITOR="${EDITOR:-omarchy-launch-editor --inline}"
|
||||
export SUDO_EDITOR="$EDITOR"
|
||||
|
||||
# Used by terminal programs (like gh) to open URLs detached from the terminal
|
||||
# process tree. Shell-scoped on purpose: exporting BROWSER session-wide makes
|
||||
# xdg-settings refuse to change the default browser.
|
||||
export BROWSER="${BROWSER:-omarchy-launch-browser}"
|
||||
export BAT_THEME=ansi
|
||||
|
||||
# Color man pages with bat
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
# Install other terminals via Install > Terminal
|
||||
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
|
||||
# BROWSER is intentionally not exported here: session-wide, it makes xdg-settings
|
||||
# refuse to change the default browser, which breaks the browsers' own "Set as
|
||||
# default" buttons. Interactive shells get BROWSER from default/bash/envs instead.
|
||||
|
||||
# Used by terminal programs to open files with the selected Omarchy default editor
|
||||
export EDITOR="omarchy-launch-editor --inline"
|
||||
|
||||
@@ -9,7 +9,6 @@ if [ -f "${OMARCHY_PATH%/}/default/uwsm/default" ]; then
|
||||
. "${OMARCHY_PATH%/}/default/uwsm/default"
|
||||
else
|
||||
export TERMINAL=xdg-terminal-exec
|
||||
export BROWSER=omarchy-launch-browser
|
||||
export EDITOR="omarchy-launch-editor --inline"
|
||||
fi
|
||||
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "$0")/base-test.sh"
|
||||
|
||||
envs="$ROOT/default/bash/envs"
|
||||
uwsm_default="$ROOT/default/uwsm/default"
|
||||
uwsm_env="$ROOT/default/uwsm/env.d/10-omarchy"
|
||||
|
||||
browser=$(env -u BROWSER bash -c 'source "$1"; printf "%s" "$BROWSER"' bash "$envs")
|
||||
[[ $browser == "omarchy-launch-browser" ]] || fail "bash env provides a default browser" "actual: $browser"
|
||||
pass "bash env provides a default browser"
|
||||
|
||||
browser=$(BROWSER=firefox bash -c 'source "$1"; printf "%s" "$BROWSER"' bash "$envs")
|
||||
[[ $browser == "firefox" ]] || fail "bash env preserves the inherited browser" "actual: $browser"
|
||||
pass "bash env preserves the inherited browser"
|
||||
|
||||
# A session-wide BROWSER makes xdg-settings refuse "set default-web-browser",
|
||||
# breaking the browsers' own "Set as default" buttons.
|
||||
browser=$(env -u BROWSER bash -c 'source "$1"; printf "%s" "${BROWSER:-}"' bash "$uwsm_default")
|
||||
[[ -z $browser ]] || fail "uwsm session env leaves BROWSER unset" "actual: $browser"
|
||||
pass "uwsm session env leaves BROWSER unset"
|
||||
|
||||
! grep -q "export BROWSER" "$uwsm_env" || fail "uwsm env.d fallback leaves BROWSER unset"
|
||||
pass "uwsm env.d fallback leaves BROWSER unset"
|
||||
Reference in New Issue
Block a user