Skip to content

Instantly share code, notes, and snippets.

@fabioam
Last active September 13, 2022 21:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabioam/1c12bd455eca57cab71e67b8cee7c434 to your computer and use it in GitHub Desktop.
Save fabioam/1c12bd455eca57cab71e67b8cee7c434 to your computer and use it in GitHub Desktop.
Run cool-retro-term as Guake
# This script searchs for the application with the
# given classname. There are three possibilities:
# 1. If the app is not open, opens it
# 2. If the app is open but is not the active window, activates it
# 3. If the app is open AND is the active window, minimizes it#
# The idea is to assign this script to keyboard shortcuts in order
# to launch/activate/minimize a common used application quickly
#
# Requieres 'xdotool' installed
APPNAME="$1"
WINDOWIDS=( $(xdotool search --class $APPNAME) )
ACTIVEWINDOW=$(xdotool getactivewindow)
if [ -n "$WINDOWIDS" ]; then
for i in "${WINDOWIDS[@]}"
do
# si es la ventana activa la miniza, si no, la activa
if [ "$i" == "$ACTIVEWINDOW" ]; then
xdotool windowminimize $i &
else
xdotool windowactivate $i &
fi
done
else
$APPNAME "${@:2}" &
fi
@fabioam
Copy link
Author

fabioam commented Mar 16, 2018

  1. Create a executable file with content above (Ex: ~/bin/runapp.sh)
  2. Create a shortcut to this app + cool-retro-term command: "Ex: ~/bin/runapp.sh cool-retro-term --fullscreen"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment