Skip to content

Instantly share code, notes, and snippets.

@eduherraiz
Created December 21, 2015 08:38
Show Gist options
  • Save eduherraiz/7e9f8755075640b45078 to your computer and use it in GitHub Desktop.
Save eduherraiz/7e9f8755075640b45078 to your computer and use it in GitHub Desktop.
#!/bin/bash
#for i in `wmctrl -l |grep Konsole| awk '{print $1}'`
#do
# wmctrl -i -a $i
#done
#filename:toggleWindow
#Written by bbq
#Mon Apr 16 20:04:12 CST 2012
#Usage: toggleWindow WINDOWCLASS
#check if the xdotool is installed
hash xdotool 2>/dev/null || { echo -e >&2 "I require xdotool but it's not installed. Please install it first!\n Aborting.\n"; exit 1; }
activeWin=`xdotool getactivewindow`
searchList=`xdotool search --class konsole`
if [[ -z "$searchList" ]]
then
echo "No windows found. Opening konsole for first time"
konsole
exit
fi
echo `echo $searchList | grep $activeWin`
if [[ `echo $searchList | grep $activeWin` ]]
then
for i in $searchList
do
xdotool windowminimize $i
done
echo minimized konsole
else
for i in $searchList
do
xdotool windowactivate $i
done
echo raised konsole
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment