• You are not logged in.

    Switch Caps Lock and Control keys Emacs

    • Started by t00ling
    • 4 Replies:
    • Reputation: 0
    • Registered: 14-Aug-2010
    • Posts: 4

    Hi,
    I'm an Emacs user and heavily rely on the Caps Lock key to function as a Control key.
    I would like to switch to Colemak but the default keyboard setting for Caps Lock is Backspace.
    I have tried to remap Caps Lock back to the Control key by configuring my ~/.Xmodmap file as

    !
    ! Swap Caps_Lock and Control_L
    !
    remove Lock = Caps_Lock
    remove Control = Control_L
    keysym Control_L = Caps_Lock
    keysym Caps_Lock = Control_L
    add Lock = Caps_Lock
    add Control = Control_L

    and my ~/.Xkbmap file as

    setxkbmap -layout us -variant colemak -option ctrl:nocaps
    .

    Both attempts have proved futile and the Caps Lock key still functions as a backspace inside Emacs.
    I'm using a Lenovo X200 laptop running Fedora 11 with gnome.
    Does anyone know how I can map the Caps Lock key as a Control Key for Colemak?
    Any help would be much appreciated. Thanks.

    Last edited by t00ling (14-Aug-2010 22:37:17)
    Offline
    • 0
    • Reputation: 0
    • From: Ann Arbor, MI
    • Registered: 25-Sep-2008
    • Posts: 36

    Try running xmodmap with:

    keycode 66 = Control_L
    add Control = Control_L

    That will make your caps lock (key 66) a control key, but it won't swap it with left control.  My xmodmap-fu isn't good enough to figure out what's wrong with what you were running (especially since it's documented in the manpage).

    Last edited by jrick (16-Aug-2010 02:08:05)
    Offline
    • 0
    • Reputation: 0
    • Registered: 14-Aug-2010
    • Posts: 4

    Thanks for the reply.
    I tried what you suggested and although the Caps Lock key now does not function as a backspace,
    it also does not function as a control key. In fact, I don't think it functions as anything.

    Offline
    • 0
    • Reputation: 0
    • From: Ann Arbor, MI
    • Registered: 25-Sep-2008
    • Posts: 36

    How are you loading colemak? I load it with xmodmap in my .xinitrc, so if you're using setxkbmap it may be different.

    Offline
    • 0
    • Reputation: 0
    • Registered: 14-Aug-2010
    • Posts: 4

    I managed to get the Caps Lock key to function as a Control key by modifying the colemak layout file itself.
    So in the /usr/share/X11/xkb/symbols/us file, change the following line under xkb_symbols "colemak"

      key <CAPS> { [    BackSpace,    BackSpace,       BackSpace,        BackSpace ] };

    to

      key <CAPS> { [    Control_L,    Control_L,       Control_L,        Control_L ] };

    Thanks for the suggestions. It really helped.

    Offline
    • 0