Skip to content

Instantly share code, notes, and snippets.

@fabioam
Last active Sep 13, 2022
Embed
What would you like to do?
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