Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement