I have a Lenovo Yoga 300. It works well with Ubuntu, but I have a problem with a keyboard lock.
As it is a Yoga model, it has different modes of usage. When I turn the screen it should lock the keyboard for a normal usage of tablet or tent mode, but it does not lock it.
Is there any key or command that I could use to lock keyboard and unlock it when I need? Even if there is a program for it, that would be helpful.
Best Answer
You can use
xinput
to achieve what you want.xinput
is a utility to list available input devices, query information about a device and change input device settings. Open a terminal and executexinput list
- you will receive an output information which will read like this :To lock a device execute this command :
xinput --set-prop <device id> "Device Enabled" 0
Example :
To lock the keyboard :
xinput --set-prop 11 "Device Enabled" 0
(11->device id from list)To unlock it,
xinput --set-prop <device id> "Device Enabled" 1
Caution! : Do not lock yourself out by locking all devices.
To lock for a given amount of time, say 5 minutes, do this :
Note : Logging out and logging back in will unlock all devices.