blob: 55e4364434a0fbf34a758dcf89a22f4a07588d49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/bin/sh
if [ -z "$SSH_CLIENT" ]; then
$(command -vp xdg-open) "$@"
exit 0
fi
HOSTNAME=$(uname -n)
printf %s "$@" |
sed -e "s/localhost/$HOSTNAME/" -e "s/127\(\.[0-9]\{1,3\}\)\{3\}/$HOSTNAME/" |
if [ -S "$XDG_RUNTIME_DIR"/xdg-open.socket ]; then
if stderr=$(nc -UN "$XDG_RUNTIME_DIR"/xdg-open.socket | grep .); then
printf %s\\n "$stderr" 1>&2
exit 1
fi
fi
|