MOUSE=`xinput -list | grep -i 'mouse' | grep id= | sed 's:.*id=\([0-9]*\).*:\1:' `
TP=`xinput -list | grep -i 'touchpad' | grep id= | sed 's:.*id=\([0-9]*\).*:\1:' `
left() {
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x' `&& HALF=$(($WIDTH/2-30)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
}
right() {
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x' `&& HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1
}
top() {
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
}
# ----- Don't edit below this line unless you know what you are doing.
if /usr/bin/X11/xinput --query-state $MOUSE | grep down
then
while (/usr/bin/X11/xinput --query-state $MOUSE | grep down)
do
echo 'mouse button pressed'
done
$1
else if /usr/bin/X11/xinput --query-state $TP | grep down
then
while (/usr/bin/X11/xinput --query-state $TP | grep down)
do
echo 'touchpad button pressed'
done
$1
else
echo "exiting because button is not pressed"
exit 1
fi
fi