Just a short script I wrote to disable my mouse to get me into better workflow habits - General Shell Scripting
xero
(07-05-2015, 05:51 AM)bsdkeith Wrote: Now that could be handy when you don't want an accidental brushing of the touchpad to interupt your keyboarding on a laptop. (Thanks for posting.)

that's it exactly for me. my touchpad is positioned in a way that this was very frequent. so i made the above script and bound it to MOD+M. so i just toggle it on when i need it, then toggle it back off again when i'm done.
Wildefyr
Made the script use wmp (from wmutils) and it performs much better than using xdotool:

Code:
while :; do
    case $1 in
        -e|--enable)
            wmp 960 540
            xinput set-int-prop $(xinput | awk '/Mouse/ {printf "%s",$9}' | sed 's/id=//') "Device Enabled" 8 1
            break
            ;;
        -d|--disable)
            wmp $(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
Wildefyr
Minor upgrade to make it not use xrandr and instead use the base 'root' window. Yay for wmutils!

Code:
#!/bin/sh

# File       : /home/wildefyr/.fyre/scripts/mouse
# Maintainer : Wildefyr | http://wildefyr.net
# Copyright  : Wildefyr | Licensed under the WTFPL license.

case $1 in
    -e|--enable)
        wmp 870 1040
        xinput set-int-prop $(xinput | awk '/Mouse/ {printf "%s",$9}' | sed 's/id=//') "Device Enabled" 8 1
        break
        ;;
    -d|--disable)
        ROOT=$(lsw -r); SW=$(wattr w $ROOT); SH=$(wattr h $ROOT); wmp $SW $SH
        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
Interesting, will have to try it later. I am guilty of sometimes using the arrows keys in vim.
bsdkeith
(01-07-2015, 05:08 PM)October Wrote: Interesting, will have to try it later. I am guilty of sometimes using the arrows keys in vim.
Sacriledge! :)
Wildefyr
Been thinking over mouse control recently more and used the remains of this script to help power my mouse control in fyre. Here's an example.




Members  |  Stats  |  Night Mode