Set up opener. Support multiple hosts.

Enable with `systemctl --user enable --now opener@myhost`
This commit is contained in:
Daniel Lundin 2024-03-12 15:44:19 +01:00
parent fe11201cdb
commit e176c27955
3 changed files with 22 additions and 0 deletions

11
bin/xdg-open Executable file
View file

@ -0,0 +1,11 @@
#!/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