Enable/Disable keyboard or laptop touchpad with bash scripts


Hello fellow MATE users/lovers,

I'm sharing 2 bash scripts I made that use the xinput command to enable/disable the keyboard or the laptop touchpad. While you can find (sure better) similar scripts or apps that achieve the same results, or create aliases of xinput with parameters and save them in your ~.bash_aliases file, these shared scripts could be helpful to Linux newbies that are learning command line (those really exist? :no_mouth:), and besides ... these scripts do work :wink:

To execute add the execution permission to each script ( $ chmod u+x script name )
The scripts can be run at the command line ( $ bash script name ) or add them to your MATE menu as additional items (this will show a notification on your desktop).

Touchpad driving me crazy

What would you use that for?

If keyboard is disabled, how do you input something?


I remember somebody disabling the keyboard in his laptop to cleaning it and after that, re-enabling it. Because the script donโ€™t disable the mouse, if you already added the KbOnOff script as an item in your MATE menu, all you need is click on the menu launcher. I use the KbOnOff script on a HP laptop that have the internal keyboard damaged because a water spill; I attached an external keyboard to the laptop and the script do not affect it.


It comes in handy when you and your toddler are skyping parents/grandparents.


So hitting a key messes that up ?

I donโ€™t use Skype.