dotfiles/bin/xdg-open
Daniel Lundin e176c27955 Set up opener. Support multiple hosts.
Enable with `systemctl --user enable --now opener@myhost`
2024-03-12 16:07:01 +01:00

11 lines
263 B
Bash
Executable file

#!/usr/bin/env sh
set -eu
# 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