On the computer upstairs we have an option to make the computer make a sound when we press Caps Lock, Number Lock and Scroll Lock. Is there a way to do this on Ubuntu 12.04?
81 Answer
Ok, so I got this to work with xbindkeys.
We will use Beep as notification sound.
To install Beep:
sudo apt-get install beepIt is necessary to enable the speaker in recent versions.
modprobe pcspkrOk, now for the notification script:
First make a new file, and save it as notification.sh.
Insert this piece of script(smallest script ever?):
beepand save it.
Place it somewhere safe, for this little "tut" I will place it in /home/notification/
Now we need xbindkeys:
sudo apt-get install xbindkeysOnce it is installed, go to your home folder, and make a new file named:".xbindkeysrc".
This file is required for xbindkeys, without, it doesn't function.
Open this file with a text editor.
Now we do need the keynumbers xbindkeys requires.
To get those, open terminal, and enter:
xbindkeys -kA windows will popup, and then you are to press the key you want the code from, eg. Capslock.
You will see something like:
in $HOME/.xbindkeysrc to bind a key. "NoCommand"
m:0x2 + c:66
Caps_Lock
Now, we only need the m:0x2 + c:66 part(might be different for you).
Write those down(in a text editor or something) and repeat the process until you got all your keys.
Now, remember the xbindkeysrc we opened in the texteditor? We are going to add the following:
"bash /home/notification/notification.sh"This line will tell what the xbindkeys has to do when certain keys are pressed. The next line we will add is the keycode(s), like this:
m:0x2 + c:66if you want the same thing to happen with multiple keys, you must separate the keys, like this:
m:0x2 + c:66 || m:0x3 + c:67The || means OR, this is not relevant for you.
A logout/login could be necessary to map the beep to the Caps Lock (for example).
I hope that this guide was useful for you and others.
2