diff options
author | Guillermo Ramos | 2022-01-20 11:16:42 +0100 |
---|---|---|
committer | Guillermo Ramos | 2022-01-20 11:16:48 +0100 |
commit | acf0af089501a0d1d167df73426f28d57081df96 (patch) | |
tree | 5a0efc106524f09cf02a6cdca71af14322c76006 /gruake | |
parent | a825bb90dd4548008c0aeeacea868f35c7f1c21f (diff) | |
download | cli-acf0af089501a0d1d167df73426f28d57081df96.tar.gz |
gruake: optimize non-tty use
Diffstat (limited to 'gruake')
-rwxr-xr-x | gruake | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1,11 +1,17 @@ #!/bin/sh # -# Guake-like show-and-hide terminal in a couple of lines of code. -# Powered by urxvt+tmux +# 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 + kill "$pid" else - urxvt -name gruake -e sh -c 'tmux new -A -s gruake' + 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 |