dotfiles/bin/xdg-open

11 lines
262 B
Bash
Executable file

#!/usr/bin/env sh
set -e
# Use local xdg-open if not in an ssh session
[ -n "$SSH_TTY" ] || exec /usr/bin/xdg-open "$@"
if [ -p /dev/stdin ]; then
exec nc -U "$XDG_RUNTIME_DIR/opener.sock" </dev/stdin
else
echo "$@" | nc -U "$XDG_RUNTIME_DIR/opener.sock"
fi