My script will work with any xinput device that shows up when you type xinput list -name-only.My solution gets the enabled/disabled information from a parsed xinput command. The file will tell you the keyboard is disabled (if you disabled it with the script), but after a reboot it will be enabled again. Relying on a file to hold the enabled/disabled state will fail if you reboot as well.This happened to me when running xinput float 13. Relying on an id number with xinput fails when you reboot and the id number is changed.Some problems with the previous answers and benefit of my script: ![]() I have a keyboard shortcut that runs it set to Ctrl Win K. ![]() Create the following launcher (in home/user/.local/share/applications) and add it to unity : Desktop entry (Unity launcher, Ubuntu 17.10 and below) įor what it's worth, based on previous answers and my own playing around, I created the following script, which I call toggle_keyboard.sh and place in my ~/bin path. Change if you want to create configuration file in another directoryĭon't try to run the script if you can't run it again without the use of your keyboard (unless you got another keyboard of course). Id as the keyboard id (found it with xinput)įconfig path to config file. Icoff as the path of the icon to display when disabling Icon as the path of icon to display when enabling (for instance, /home/user/path/icon.png) Notify-send -i $Icoff "Disabling Keyboard" \ "OFF - Keyboard disconnected" Bash script to enable/disable keyboard #!/bin/bash Here is a little switch button to enable and disable a specific keyboard.įirst, you have to find your keyboard id with xinput or xinput-list. ⎜ ↳ Logitech USB-PS/2 Optical Mouse id=12 So if the number was 3, you would do xinput reattach 10 3. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |