Author Topic: [Bash] Disable Keyboard  (Read 467 times)

0 Members and 1 Guest are viewing this topic.

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
[Bash] Disable Keyboard
« on: June 05, 2014, 05:02:05 pm »
A while ago techb wrote a simple script to disable his keyboard. The problem tho is that his won't work for laptops, as you have to plug the keyboard out and in again. That's why I decided to write my own little bash script...

First run "xinput --list" to find the ID of the device you want to disable.
Afterwards use "xbindkeys -k" to find a key combo of "Fn + Key" with the name XF86Launch1 (or 2,3,4,...). Often there are different kinds of symbols on the bottom left of the key on the keyboard wich indicate a special key combo with the Fn key.
These key combinations will also work when the keyboard is disabled.

Finally, save the following script somewhere on your computer, replace the ID in the script (12) with the ID of the device you want to disable, and assign the upper key combo to this script.

Code: [Select]
#!/bin/bash

STATE=`xinput --list-props 12 | grep "Device Enabled" | awk '{print $4}'`

if [ $STATE -eq 0 ]
then
xinput set-int-prop 12 "Device Enabled" 8 1
else
xinput set-int-prop 12 "Device Enabled" 8 0
fi
« Last Edit: June 05, 2014, 06:21:36 pm by flowjob »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow