Skip to content

Instantly share code, notes, and snippets.

@fooblahblah
Last active January 2, 2016 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fooblahblah/8324644 to your computer and use it in GitHub Desktop.
Save fooblahblah/8324644 to your computer and use it in GitHub Desktop.
Given a window name, toggle window over - ala visor, yakuake, etc
#!/bin/bash
usage() { echo "Usage: $0 [-mh]" 1>&2; exit 1; }
while getopts ":mh" o; do
case "${o}" in
m)
echo "found m"
m="enabled"
;;
h)
usage
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
APP_NAME=$1
WIN_ID=`wmctrl -lx | grep -i $APP_NAME |cut -f1 -d' '`
STATE_FILE="/tmp/overlay_state_$APP_NAME"
if [ ! -e $STATE_FILE ]; then
echo "0" > $STATE_FILE
fi
STATE=`cat $STATE_FILE`
if [ $STATE == "1" ]; then
wmctrl -i -Y $WIN_ID
# wmctrl -ir $WIN_ID -b remove,maximized_vert,maximized_horz
echo "0" > $STATE_FILE
else
if [ "$m" == "enabled" ]; then
wmctrl -ir $WIN_ID -b add,maximized_vert,maximized_horz
fi
wmctrl -iR $WIN_ID
echo "1" > $STATE_FILE
fi
@fooblahblah
Copy link
Author

Note: This gist requires a custom install of the updated wmctrl with -Y support: https://github.com/geekless/wmctrl

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