summaryrefslogtreecommitdiff
path: root/sshmenu
blob: 115a1114a9e2c482719f34686ef8e4512d1c0398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

if [ $DISPLAY ] && command -v dmenu >/dev/null; then
	host=$(grep "^Host" $HOME/.ssh/config | cut -d ' ' -f 2 | dmenu -i -c -l 10 -p "SSH to:")

	[ "$host" ] || exit 0

	setsid -f $TERMINAL -e ssh $host -t "tmux -u new -A"
else
	host=$(grep "^Host" $HOME/.ssh/config | cut -d ' ' -f 2 | fzf -e --reverse --prompt "SSH to: ")

	[ "$host" ] || exit 0

	ssh $host -t "tmux -u new -A"
fi