#!/usr/bin/sh if [ -n "$SSH_CLIENT" ]; then 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 ] && command -v nc >/dev/null; then nc -UN "$XDG_RUNTIME_DIR"/xdg-open.socket else xargs -I{} ssh -l "$USER" -p 2222 localhost "xdg-open '{}'" fi else $(command -vp xdg-open) "$@" fi