Sometimes when writing a lot on a laptop, if you do not have good wrist-up typing posture like me, you may be constantly cursing the fact that you drop your hands onto the laptop keyboard while typing. Old habits die hard. So, you might want to disable the trackpad from time to time quickly.
If you are a commandline guy like me, you want to make a quick script to do this.
So I made this quickly today, a script that will turn off your keypad. This should work fine on Debian/etc, you might change out apt for your package manager if it provides an xinput repo.
The way I found this info before writing the script:
└──╼ $xinput list-props 14 Device 'DLL06B5:00 06CB:75DB Touchpad': Device Enabled (174): 1
Found I could turn off the trackpad with:
xinput set-prop 14 174 0
So, wrote a script so people can run it and end up with 2 scripts:
trackpad-on # Turn it on trackpad-off # Turn it off
#!/bin/bash instructions() { echo "[!] No device found! exiting, you must do this manually:" echo "xinput --list" echo " ^^ search for the device and note its id= , I'll call this number {id}" echo "xinput --list-props {id} | head -n 10" echo " ^^ check the devices properties, enabled property should be the top one, likely, you can probably use | grep -i 'enabled'" echo "xinput set-prop {id} {prop} 0" echo " ^^ turns the trackpad off" echo "xinput set-prop {id} {prop} 1" echo " ^^ turns the trackpad back on" echo "[+] Good luck! " } w=$(which xinput) if [[ -z "$w" ]]; then echo "[?] xinput not found, install with apt? [Y/n] " read i if [[ -z "$i" ]]; then i="y" else if [[ "$i" == "y" || "$i" == "Y" ]]; then sudo apt update ; sudo apt installl -y xinput echo; echo; echo "[+] Done! Hopefully all is good, checking:" wh=$(which xinput) echo "[+] xinput now installed: $wh" else echo "[.] Then exiting.. You need this to continue." exit fi fi fi echo "[.] Looking for device with 'pad' in the name.." dev=$(xinput --list | grep -i 'pad' | awk '{print $6}' | sed 's/id=//g') if [[ -z "$dev" ]] ; then instructions else echo echo "[+] Device found: id=${dev}" echo "[.] Checking for Enabled in --list-props .." prop=$(xinput --list-props ${dev} | grep -i "nabled" | awk '{print $3}' | tr -d "():") echo "[+] Property likely found: $prop" echo "[.] Lets try turning it off. Running: xinput set-prop $dev $prop 0" xinput set-prop $dev $prop 0 echo "[?] Did that work?" read i if [[ -z "$i" ]]; then i="y" else if [[ "$i" == "y" || "$i" == "Y" ]]; then echo "[+] Great, building scripts.. (turned it back on for you also.)" xinput set-prop $dev $prop 1 echo echo "[?] Please enter password for sudo, commands are:" echo "#!/bin/bash" > trackpad-on cp trackpad-on trackpad-off echo "xinput set-prop $dev $prop 0" >> trackpad-off echo "xinput set-prop $dev $prop 1" >> trackpad-on chmod +x trackpad-off trackpad-on echo "[?] Please enter password for sudo to place scripts in /usr/local/bin, commands being run are:" echo "sudo mv trackpad-off /usr/local/bin/" echo "sudo mv trackpad-on /usr/local/bin/" sudo mv trackpad-off /usr/local/bin/ sudo mv trackpad-on /usr/local/bin/ echo "[+] Okay, done. You can now use these commands in your shell:" echo " trackpad-off # Turns trackpad off" echo " trackpad-on # Turns trackpad on" else echo "[-] Okay, exiting. You can use these commands if you'd like instead, or copy these lines to your ~/.bashrc file and source ~/.bashrc: " echo "xinput set-prop $dev $prop 0 # Turns trackpad off" echo "xinput set-prop $dev $prop 1 # Turns trackpad on" echo 'alias trackpad-off="xinput set-prop $dev $prop 0" # Turns trackpad off" echo 'alias trackpad-on="xinput set-prop $dev $prop 1" # Turns trackpad on' exit fi fi fi echo "[+] Exiting."`