aboutsummaryrefslogtreecommitdiff
path: root/gruake
blob: 4e6987ecd1a657dbdaf04543296f9c5465c6a7f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
#
# Guake-like show-and-hide terminal in a few lines of code.
# Powered by urxvt+tmux.
################################################################################

if pid=$(pgrep -f 'urxvt.*gruake'); then
    kill "$pid"
else
    if [ -t 0 ]; then
        # If running in a tty, spawn terminal in background
        urxvt -name gruake -e sh -c 'tmux new -A -s gruake' &
    else
        # otherwise, probably run from a hotkey daemon so just exec
        exec urxvt -name gruake -e sh -c 'tmux new -A -s gruake'
    fi
fi