In the the past I used to use xmodmap
to prevent the Caps Lock button from working, and then tell Launchy to handle the key press instead. I can't seem to do this anymore.
What is the best way to disable Caps Lock's normal behavior, and make it do something else?
From howtogeek.com which has a good answer for any OS.
For Linux (including Ubuntu):
Where
<OPTION>
can be for example of:caps:none
– Disables Caps Lock.caps:super
– Caps Lock becomes an additional Super (aka Win key).caps:ctrl_modifier
– Caps Lock becomes an additional Ctrl.caps:numlock
– Caps Lock becomes an additional Num Lock.caps:escape
– Caps Lock becomes an additional Escape.caps:backspace
– Caps Lock becomes an additional Backspace.caps:swapescape
– Caps Lock becomes Escape, and Escape becomes Caps LockNote: Xmodmap is deprecated in favor of setxkbmap.
In Ubuntu 11.10 - 13.04
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.
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.
This is basically a modification of the answer provided at https://askubuntu.com/a/223674/22073.
You can also modify the behavior of Caps Lock using an
XKBOption
. These changes are even propogated to the virtual consoles (/dev/tty[1-6], or Ctrl-Alt-F[1-6]).For instance, to disable Caps Lock, you would have the following in
/etc/default/keyboard
:Then you would run:
For a full list of the customizations of XKBOPTIONS, take a look at
/usr/share/X11/xkb/rules/base.lst
. Here's the full list from my Ubuntu 13.10 machine: http://sprunge.us/cUZOEven more information can be found on the ArchLinux wiki: https://wiki.archlinux.org/index.php/Keyboard_Configuration_in_Xorg
To remap the useless caps_lock into a basic shift, do
The following method uses the combination of Compiz to launch an application when a key-press is made.
In summary -
Change the caps lock key
Too change the behaviour of the Caps Lock Key, you can use
xmodmap
as follows: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:
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.
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".
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:
Notice
keycode
(66) andkeysym
(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:
Bind the new key's function to the Caps Lock button, using xmodmap. I'm pretty sure you want to use a command like:
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.
Test it to make sure the command I gave you works the way you want it to.
Go to startup applications, and add that command to your startup applications. This way, the key will switch properly every time you start up.
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
Ubuntu 16.04
setxkbmap -option <OPTION>
from Wernight's answer seemed to work immediately for me.However it would go away on reboot. To address this I added to my startup applications
Startup Applications
>> Click Add/usr/bin/setxkbmap -option <OPTION>
as the command (Note: the full path is important)Replace
<OPTION>
with something likecaps:escape
(I use it for vi)Background
I just upgraded from 15.10 to 16.04 and whatever I used to map this before stopped working.
while of course the xmodmap option would work I wanted to find an option that uses the GUI. This is available for me (using Ubuntu 15.10):
The option that I found the best for me (in any X compatible wm/de) is adding
inside the
block in /etc/X11/xorg.conf.d/00-keyboard.conf (create if necessary).