Quote:
Originally Posted by onesapien
Hi everyone,
New Linux user here.
Keyboard of my laptop is malfunctioning and wreaks havoc until its disabled.
I use "xinput float" command for it.
I want to disable it as soon as I log in. How can I write a script for disabling it or make it sort of a desktop icon which will execute this.
|
There are several ways to do this.
If you have the command you want to execute (looks like you do) just create the simple script, say, "disable_kbd":
Code:
#!/bin/bash
xinput float
Put this in ${HOME}/bin (assuming you have such a directory and it's in your PATH. Make it executable -- "chmod u+x ~/bin/disable_kbd". (If you haven't seen it before, "${HOME}" and "~" both refer to your home directory.)
Now go into your desktop manager and look for a panel widget that allows you to create a simple launcher. Create a new launcher for your panel and specify that script (with full path) as the command to execute. The drawback to this is: If you like to switch desktop managers from time to time, this method will only make your keyboard disabler available in the desktop environment in which you created the launcher.
Alternate: copy the script to ${HOME}/Desktop/. Refresh your desktop. You can launch it by double clicking on it. This isn't a great solution, though. If you were to edit the copy of the script in ~/Desktop, depending on the editor you use, you might wind up with the editor backup file (say, "disable_kbd~") cluttering the desktop.
Better: cd to your Desktop directory and create a symbolic link to the script:
Code:
$ cd ~/Desktop
$ ln -s ~/bin/disable_kbd .
Again, refresh your desktop. This method keeps you a.) from having two copies of the script laying around (one in ~/bin and another in ~/Desktop) and b.) eliminates the head scratching you'll do when you modify the one in your bin directory and the one on your desktop doesn't do what you expect.
As before, you launch it by double clicking on it.
HTH...