mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-30 16:35:16 +08:00
Don't use a graphical browser under SSH
...unless X is also being forwarded. Someone else will have to figure out the Wayland equivalent (if that even exists). Not my monkey, not my circus.
This commit is contained in:
parent
7d77d7aa84
commit
98642d307a
@ -48,7 +48,9 @@ function help --description 'Show help for the fish shell'
|
|||||||
|
|
||||||
# If we are in a graphical environment, check if there is a graphical
|
# If we are in a graphical environment, check if there is a graphical
|
||||||
# browser to use instead.
|
# browser to use instead.
|
||||||
|
set -f is_graphical 0
|
||||||
if test -n "$DISPLAY" -a \( "$XAUTHORITY" = "$HOME/.Xauthority" -o -z "$XAUTHORITY" \)
|
if test -n "$DISPLAY" -a \( "$XAUTHORITY" = "$HOME/.Xauthority" -o -z "$XAUTHORITY" \)
|
||||||
|
set is_graphical 1
|
||||||
for i in $graphical_browsers
|
for i in $graphical_browsers
|
||||||
if type -q -f $i
|
if type -q -f $i
|
||||||
set fish_browser $i
|
set fish_browser $i
|
||||||
@ -57,6 +59,8 @@ function help --description 'Show help for the fish shell'
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If we're SSH'd into a desktop installation, don't use a regular browser unless X is being forwarded
|
||||||
|
if not set -q SSH_CLIENT || test $is_graphical -eq 1
|
||||||
# We use the macOS open, but not otherwise.
|
# We use the macOS open, but not otherwise.
|
||||||
# On Debian, there is an open command that's a symlink to openvt.
|
# On Debian, there is an open command that's a symlink to openvt.
|
||||||
if uname | string match -q Darwin && command -sq open
|
if uname | string match -q Darwin && command -sq open
|
||||||
@ -68,8 +72,8 @@ function help --description 'Show help for the fish shell'
|
|||||||
# If the OS appears to be Windows (graphical), try to use cygstart
|
# If the OS appears to be Windows (graphical), try to use cygstart
|
||||||
if type -q cygstart
|
if type -q cygstart
|
||||||
set fish_browser cygstart
|
set fish_browser cygstart
|
||||||
# If xdg-open is available, just use that
|
|
||||||
else if type -q xdg-open
|
else if type -q xdg-open
|
||||||
|
# If xdg-open is available, just use that
|
||||||
set fish_browser xdg-open
|
set fish_browser xdg-open
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -89,6 +93,7 @@ function help --description 'Show help for the fish shell'
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if not set -q fish_browser[1]
|
if not set -q fish_browser[1]
|
||||||
printf (_ '%s: Could not find a web browser.\n') help >&2
|
printf (_ '%s: Could not find a web browser.\n') help >&2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user