Just a short script I wrote to disable my mouse to get me into better workflow habits - Programming On Unix

Users browsing this thread: 1 Guest(s)
Wildefyr
Long time nixers
Got mad at myself for constantly using the mouse for certain tasks when I can just use the keyboard for it. Wrote this little script to find my mouse and disable me completely from using it. Touched it up a little after to make it auto detect the mouse device and the screen resolution:

Code:
#!/bin/bash

while :; do
    case $1 in
        -e|--enable)
            xinput set-int-prop $(xinput | awk '/Mouse/ {printf "%s",$9}' | sed 's/id=//') "Device Enabled" 8 1
            break
            ;;
        -d|--disable)
            xdotool mousemove $(xrandr | awk '/Screen 0/ {printf "%s",$8 " " $10}' | sed 's/,$//')
            xinput set-int-prop $(xinput | awk '/Mouse/ {printf "%s",$9}' | sed 's/id=//') "Device Enabled" 8 0
            break
            ;;
        *)
            echo "Usage: ./mouse [option]:

-e | --enable: Enable Mouse
-d | --disable: Disable Mouse"
            break
    esac
done


Messages In This Thread
Just a short script I wrote to disable my mouse to get me into better workflow habits - by Wildefyr - 04-05-2015, 06:50 PM