Last active
January 2, 2016 15:39
-
-
Save fooblahblah/8324644 to your computer and use it in GitHub Desktop.
Given a window name, toggle window over - ala visor, yakuake, etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This gist requires a custom install of the updated wmctrl with -Y support: https://github.com/geekless/wmctrl