Skip to content

Instantly share code, notes, and snippets.

@jpetazzo
Created January 9, 2015 17:06
Show Gist options
  • Save jpetazzo/449b2ab1840d4c9e2a7b to your computer and use it in GitHub Desktop.
Save jpetazzo/449b2ab1840d4c9e2a7b to your computer and use it in GitHub Desktop.
Mouses Are Overrated!

Mouses Are Overrated

This script allows you to enable/disable your pointers on a Linux machine.

Usage:

mao.sh on   # enters "mouseless" mode
mao.sh off  # returns to "I can has clicks" mode

Note: if you just want to disable built-in pointers (to keep a mouse on the side for gaming or other purposes), you can comment the slave pointer line, and uncomment the two others (and maybe adapt them to the pointers you want to disable).

Enjoy!

#!/bin/sh
get_ids () {
xinput list | grep "$1" | sed 's/.*id=\([0-9]*\).*/\1/'
}
case "$1" in
on)
get_ids "slave pointer" | xargs -n1 xinput float
#get_ids "DualPoint Stick" | xargs -n1 xinput float
#get_ids "DualPoint TouchPad" | xargs -n1 xinput float
;;
off)
master_id=$(get_ids "master pointer" | head -n 1)
get_ids "floating slave" | xargs -I ID -n1 xinput reattach ID $master_id
;;
*)
echo "$0 <on|off>"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment