Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
Yes this is possible, I quite forgot how. Let me get back to this. –  Dr_Bunsen Dec 29 '12 at 12:19
Cool. Hope u can work it out! –  nerof61 Dec 29 '12 at 12:26
This is kinda the answer you want. I will keep looking: webupd8.org/2011/01/… –  Dr_Bunsen Dec 29 '12 at 12:29
I think you have to use terminal. But this looks even easier: ubuntuforums.org/showpost.php?p=11575559&postcount=2 What is the problem with terminal? –  Dr_Bunsen Dec 29 '12 at 12:32
let us continue this discussion in chat –  nerof61 Dec 29 '12 at 12:36

1 Answer 1

up vote 4 down vote accepted

Ok, so I got this to work with xbindkeys.

We will use Beep as notification sound.

To install Beep:

sudo apt-get install beep

Ok, now for the notification script:
First make a new file, and save it as notification.sh.

Insert this piece of script(smallest script ever?):


and safe it.
Place it somewhere safe, for this little "tut" I will place it in /home/notification/
Now we need xbindkeys:

sudo apt-get install xbindkeys

Once 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 an text editor.

Now we do need the keynumbers xbindkeys requires.
To get those, open terminal, and enter:

xbindkeys -k

A 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

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:66

if you want the same thing to happen with multiple keys, you must separate the keys, like this:

m:0x2 + c:66 || m:0x3 + c:67

The || means or, this is not relevant for you.

I hope that this guide was usefull for you and others.

share|improve this answer
I use xbindkeys, and by installing xbindkeys-config as well as xbindkeys there is no need for xbindkeysrc ... xbindkeysrc provides an easy to use GUI interface. Setting up the shortcut keys is particularly easy; there is no need to deal directly with all the ` m:0x3 + c:67` stuff. xbindkeys is also useful in that you have more control over the modifier keys than does the default Keyboard Shortcuts app, though that app is quite good enough unless you are a keyboard shortcuts junkie (like me). –  Peter.O Dec 29 '12 at 15:03
O, I didn't know that, but I do prefer knowing that code is actually used. I will update my answer, thanks. –  Dr_Bunsen Dec 29 '12 at 15:37
That really helped. Thanks a lot! –  nerof61 Dec 30 '12 at 13:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.