Skip to content

Instantly share code, notes, and snippets.

@fooblahblah
Last active Jan 2, 2016
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@fooblahblah fooblahblah commented Jan 8, 2014

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