dot/emacs, el/dot-emacs.el: Update browser configuration.
[profile] / bin / x2x-privsep
CommitLineData
75a2ccd4
MW
1#! /bin/sh -ex
2
3dir=west bogus=nil
4usage () { echo "usage: $0 [-ensw] HOST:RDPY/LDPY"; }
5while getopts "hensw" opt; do
6 case $opt in
7 h) usage; exit ;;
8 e) dir=east ;;
9 n) dir=north ;;
10 s) dir=south ;;
11 w) dir=west ;;
12 *) bogus=t ;;
13 esac
14done
15shift $(( $OPTIND - 1))
16case $bogus,$#,$1 in nil,1,*:*/*) ;; *) usage >&2; exit 2 ;; esac
17host=${1%:*} dpy=${1##*:}; rdpy=${dpy%%/*} ldpy=${dpy#*/}
18control=ControlPath=~/.ssh/sock-%l/control-%r@%h.x2x
19ssh -o$control -L"/tmp/.X11-unix/X$ldpy:/tmp/.X11-unix/X$rdpy" -Nafx "$host"
20sleep 1
21trap 'trap - INT QUIT HUP EXIT; ssh -o$control -Oexit "$host"; rm -f "/tmp/.X11-unix/X$ldpy"' INT QUIT HUP EXIT
22x2x -$dir -to ":$ldpy"