On Ubuntu 10.04, I could use xmodmap -e "clear Lock" (or xmodmap -e "remove lock = Caps_Lock", I'm not sure) to prevent the Caps Lock button from working. But then I would tell Launchy to handle Caps Lock instead.

I can't seem to be able to do this on 11.04.

Is there any way to disable Caps Lock's normal behavior, and make Launchy handle it correctly on Ubuntu 11.04?

Update

It seems like all the answers are trying to get around the problem by rebinding caps lock to some other kind of key. This does not work for Launchy, and it also makes me wonder:
Is this because there's no "real" solution? Is there really no way to just change the functionality of Caps Lock itself, without having it mimic another key?

N.B. Launchy only supports specific symbols as hotkeys (Ctrl/Alt/Shift/nothing followed by a letter, a number, or one of a few symbols like #, %, ~, etc...)

link|improve this question

64% accept rate
1  
Uhm, why on earth would you even wish to disable the CAPS Lock key???? – zkriesse Jul 14 '11 at 4:07
1  
@zkriesse: 'cause I'm cool like that. :D – Mehrdad Jul 14 '11 at 4:09
Well, I see no purpose for it but I'll look for an answer anyway... Cause now I'm interested if it can be done :P I love a challenge :D – zkriesse Jul 14 '11 at 4:15
The command should be xmodmap -e "remove lock = Caps_Lock" As I know ! correct me if I am wrong! – Binarylife Jul 14 '11 at 4:21
@Binarylife: Neither of those work on Ubuntu 11.04. I think they worked on 10, though. :( – Mehrdad Jul 14 '11 at 4:23
show 13 more comments
feedback

4 Answers

You can disable it by going to keyboard->Layouts->options->caps lock behavior and choose "disable caps lock" .


Edit:

I don't know why it seems inconvenient with another Keyboard keys.

But Launchy works fine with me after trying it with CTRL+Super+Space.

enter image description here

And you need to white-list launchy to the tray icons. See How do I access and enable more icons to be in the system tray?. Also you need to add it to the Start Up applications, as it won't work when it is not opened.


After all, As an alternative for Launcy, try Synapse for its best integration with gnome and unity.

link|improve this answer
This doesn't really work, after when I extended the question. Thanks for the answer though. – Mehrdad Aug 1 '11 at 6:38
1  
This works and helped me. My box is using 11.04 – peck Aug 4 '11 at 15:18
@peck: It "works"? with Launchy, or with something else? – Mehrdad Aug 7 '11 at 0:32
@Mehrdad - What part of 11.04 did you not understand? – peck Sep 4 '11 at 4:55
@peck: I don't know; what part of 11.04 did you not understand? – Mehrdad Sep 4 '11 at 6:16
show 1 more comment
feedback

The following method uses the combination of Compiz to launch an application when a key-press is made.

In summary -

  1. change the behaviour of the Caps Lock key to mimic another key.
  2. Configure compiz to listen for the newly mimic'd key and run a custom script.

Change the caps lock key

Too change the behaviour of the Caps Lock Key, you can use xmodmap as follows:

  • create a file e.g. "capslock"
  • copy and paste the following into the file
keycode 66 = cent
clear Lock
add Control = cent
  • now run xmodmap to recognise your change:

xmodmap capslock

To run permanently add this command to the startup applications.

Pressing Caps Lock now just mimics pressing a "cent" key - note this is not a key that actually exists on my keyboard.

You can get a list of KeySym names from here.

Configure Compiz

Start the CompizConfig Settings Manager

In the general section, ensure "Commands" is enabled and configure a command as shown:

enter image description here

N.B. enable the key binding and use "grab key combination" to recognise your "cent" key. You cannot get compiz to recognise the cap lock key itself unfortunately.

enter image description here

Obviously - change "firefox" for whatever command you use to start "launchy"

Now when you hit the Caps Lock key, compiz will recognise the mapped "cent" key and run the command - in this case firefox - in your case "launchy".

link|improve this answer
So now Launchy launches whenever I press the Delete key? – Mehrdad Aug 4 '11 at 3:02
But the problem is that I can't think of any key that I don't use (other than caps lock)... I use every key at some point or another. – Mehrdad Aug 4 '11 at 3:11
Ah but the list of keys Launchy supports is just the keys on the keyboard (it's a limited list that I have to choose from)... so that doesn't work. – Mehrdad Aug 4 '11 at 3:23
Thanks for the update, but this still wouldn't work -- Launchy only supports specific symbols as hotkeys (Ctrl/Alt/Shift/nothing followed by a letter, a number, or one of a few symbols like #, %, ~, etc...) so it doesn't know about a "cent" key or anything like that. – Mehrdad Aug 4 '11 at 11:38
ok - have added a solution that involves compiz - hope this works for you. – fossfreedom Aug 4 '11 at 17:55
show 3 more comments
feedback

(okay, stackexchange is messing with my step numbers. They obviously should not read 1, 1, 1, 2, 3, but 1, 2, 3, 4, 5. Don't ask me why this is happening. The answer should still be helpful, though)

  1. Use the xev command. When you hit enter, xev will launch. xev takes all of your input and poops info about the key into the command line. I recommend bringing your mouse over the exit key of the xev window, hitting caps lock (or whatever key you want to find out about), and immediately exiting xev. The relevant lines on my system, for caps lock look something like:

KeyPress event, serial 36, synthetic NO, window 0x4400001, root 0x27a, subw 0x0, time 19164277, (16,-9), root:(1156,46), state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x4400001, root 0x27a, subw 0x0, time 19164397, (16,-9), root:(1156,46), state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False

Notice "keycode" (66) and "keysym" (0xffe5).

You could also, now, get data for another key -- one you don't really use, and which, in the context you want to use the caps lock button in, doesn't do anything. So, if you want caps lock to activate the Unity searchbox (like super usually does), maybe use `, for example. On my machine:

keycode 49 (keysym 0x60, grave)

  1. Bind the new key's function to the Caps Lock button, using xmodmap. I'm pretty sure you want to use a command like:

xmodmap -e "keycode 66=0x60"

Now, if you hit the physical caps lock button in a text box, the grave character (`) will appear. But if you map a shortcut key to it, it will do something else. If you want to be able to use it in a text box, perhaps replace caps lock with left shift, or f10, or something else that doesn't seem like it will interfere with the command you want to use.

  1. Test it to make sure the command I gave you works the way you want it to.

  2. Go to startup applications, and add that command to your startup applications. This way, the key will switch properly every time you start up.

  3. Dance.

(shout out to theprise) Change Keybindings (hardware to software)

Also, for more help on xmodmap: http://www.xfree86.org/4.2.0/xmodmap.1.html http://www.in-ulm.de/~mascheck/X11/xmodmap.html

link|improve this answer
... another key -- one you don't really use ... I'm having trouble finding one... :( – Mehrdad Aug 4 '11 at 3:01
As another poster in this thread mentioned, you can pick a key you don't actually have. Go look at an Apple keyboard, maybe (but be careful, because some keys are just the same as other things). – Daniel Aug 9 '11 at 3:06
feedback

In Ubuntu 11.10+

  1. Open the Keyboard Layout application and click the "Options" button.
  2. A list of rebinding options will apear. Select "Caps Lock key behavior".
  3. Select your preferred Caps Lock repurposing option.

Screenshot of available options

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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