Created
March 13, 2012 18:18
-
-
Save jamesadney/2030431 to your computer and use it in GitHub Desktop.
Hide Ubuntu Unity launcher when window is maximized
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 | |
# Install wmctrl before using: sudo apt-get install wmctrl | |
# From http://ubuntuforums.org/showthread.php?p=11761683 | |
# User settings | |
sleep 8 # Time it takes before script starts with autodetection | |
DELAY="2" # Set delay | |
# End of user settings | |
ps -ef | grep "$0" | grep -v "grep\|$$\|/bin/sh" | awk '!/awk/ {print $2}' | xargs -r kill | |
if [ "$DESKTOP_SESSION" != "ubuntu" ]; then | |
exit 0 | |
fi | |
MAX_W="$(wmctrl -lG | awk '{if ($5 > max) { max = $5;}} END {print max}')" | |
MAX_H="$(wmctrl -lG | awk '{if ($6 > max) { max = $6;}} END {print max}')" | |
HIDE_Y="$(expr $MAX_H - 24)" | |
SHOW_X="$(expr $MAX_W - $(gconftool-2 --get "/apps/compiz-1/plugins/unityshell/screen0/options/icon_size") - 17)" | |
SHOW_Y="$(expr $MAX_H - 24)" | |
while true; do | |
sleep $DELAY | |
SHOW_LAUNCHER="$(wmctrl -lpG | grep -v "Hud\|Dash" | grep -c "$SHOW_X $SHOW_Y")" | |
HIDE_LAUNCHER="$(wmctrl -lpG | grep -v "Hud\|Dash" | grep -c "$MAX_W $HIDE_Y")" | |
if [ "$SHOW_LAUNCHER" -eq "0" -a "$HIDE_LAUNCHER" -eq "0" ] | |
then | |
CURRENT="$(gconftool-2 --get "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode")" | |
if [ "$CURRENT" -ne "0" ] | |
then | |
gconftool-2 --type int --set "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode" 0 | |
fi | |
else | |
CURRENT="$(gconftool-2 --get "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode")" | |
if [ "$CURRENT" -ne "1" ] | |
then | |
gconftool-2 --type int --set "/apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode" 1 | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment