summaryrefslogtreecommitdiff
path: root/dot/local/bin/x11-ssh-host
blob: 166f4912f1f0af87329a247cc3ffeabaf29db15c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
host=$(basename "$0")
case "$host" in
    x11-ssh-host) host=$1 ;;
esac

SCRIPT="if which tmux && ! test -e .prefer-screen; then tmux attach || tmux new; else screen -xRR -e '^Zz'; fi"

if [ "$DISPLAY" -a ! -t 0 ]; then
    exec xterm -T "$host" -e \
         autossh "$host" -- -t $SCRIPT
else
    exec \
         autossh "$host" -- -t $SCRIPT
fi