-
Identify Your Laptop Keyboard Device ID: Open a terminal and run:
xinput list
This command will display a list of all input devices connected to your system. Look for an entry that corresponds to your laptop keyboard, such as "AT Translated Set 2 keyboard" or something similar. Note down the device ID (e.g., 11).
-
Disable the Keyboard: Use the following command to disable your laptop keyboard (replace
11with your actual device ID):xinput disable 11
-
Enable the Keyboard: Use the following command to re-enable your laptop keyboard (replace
11with your actual device ID):xinput enable 11 -
Create a Toggle Script: Create a script to easily toggle the keyboard state between enabled and disabled.
Script: toggle_keyboard.sh
#!/bin/bash DEVICE_ID=11 # Replace with your actual device ID if xinput list-props $DEVICE_ID | grep "Device Enabled (.*):.*1" > /dev/null then xinput disable $DEVICE_ID echo "Keyboard disabled" else xinput enable $DEVICE_ID echo "Keyboard enabled" fi
-
Make the Script Executable:
chmod +x toggle_keyboard.sh
-
Run the Script:
./toggle_keyboard.sh
To disable the keyboard automatically at startup, follow these steps:
- Open Startup Applications from the Mint menu.
- Click on Add.
- Set the Name to something like "Disable Laptop Keyboard".
- Set the Command to:
xinput disable 11 # Replace 11 with your actual device ID - Click Add and then Close.
Now, your laptop keyboard will be disabled every time you start your computer. You can enable it using the toggle_keyboard.sh script whenever needed.
Thanks a lot @arya2004 , This is very handy !