summaryrefslogtreecommitdiff
path: root/dot/local/bin/x11-ssh-host
blob: a8620a711b5fef8514d0589f20d7369d79edabef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
host=$(basename "$0")
case "$host" in
    x11-ssh-host)
        for host in "$@"
        do
            continue
        done
    ;;
esac

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

set -- autossh -- "$@" -t $SCRIPT

if [ "$DISPLAY" -a ! -t 0 ]
then
    exec xterm -T "$host" -e "$@"
else
    exec "$@"
fi