You are not logged in.

#1 2010-07-31 19:51:22

iamsmrt
Member
Registered: 2009-08-12
Posts: 138

[SOLVED] Need Help Remapping Caps Lock to Control

So I've spent the better part of an hour trying to remap my caps lock key to control. I've added a udev policy "10-keymap.fdi" in /etc/hal/fdi/policy.

<?xml version="1.0" encoding="ISO 8859-1"?>                                                                                      
   <deviceinfo version="0.2">
     <device>
       <match key="info.capabilities" contains="input.keys">
         <merge key="input.xkb.options" type="string">ctrl:nocaps</merge>
       </match>
     </device>
   </deviceinfo>

I restarted hal and it seems to acknowledge my new rule. lshal | grep xkb yields:

brian@brian-laptop:~$ lshal | grep xkb
input.xkb.layout = 'us'  (string)
input.xkb.model = 'evdev'  (string)
input.xkb.options = 'ctrl:nocaps'  (string)
input.xkb.rules = 'base'  (string)
input.xkb.variant = ''  (string)
input.xkb.layout = 'us'  (string)
input.xkb.model = 'evdev'  (string)
input.xkb.options = 'ctrl:nocaps'  (string)
input.xkb.rules = 'base'  (string)
input.xkb.variant = ''  (string)
input.xkb.layout = 'us'  (string)
input.xkb.model = 'evdev'  (string)
input.xkb.options = 'ctrl:nocaps'  (string)
input.xkb.rules = 'base'  (string)
input.xkb.variant = ''  (string)
input.xkb.layout = 'us'  (string)
input.xkb.model = 'evdev'  (string)
input.xkb.options = 'ctrl:nocaps'  (string)
input.xkb.rules = 'base'  (string)
input.xkb.variant = ''  (string)

But when I hit the caps lock key, it still gives me caps lock, not control. xev unsurprisingly tells me the keysym I'm pressing is indeed caps lock. I know I could do this by using xmodmap but I'd like to keep my .xinitrc clean/would just like to know why this isn't working.

Last edited by iamsmrt (2010-08-02 13:53:59)

Offline

#2 2010-08-01 00:26:27

Anntoin
Member
Registered: 2009-08-10
Posts: 42
Website

Re: [SOLVED] Need Help Remapping Caps Lock to Control

Its worth trying adding this to your xorg.conf:

Section "InputClass"
    Identifier "evdev keyboard catchall"
    MatchIsKeyboard "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    Option "XkbLayout" "gb"
    Option "XkbOptions" "ctrl:nocaps"
EndSection

I was having this problem for a while and this worked for me. Your mileage may vary.

Offline

#3 2010-08-01 15:17:34

nixpunk
Member
Registered: 2009-11-23
Posts: 268

Re: [SOLVED] Need Help Remapping Caps Lock to Control

iamsmrt wrote:

I know I could do this by using xmodmap but I'd like to keep my .xinitrc clean/would just like to know why this isn't working.

I use xmodmap and it's quite easy to setup.  Just curious, but why exactly do you want to keep your ".xinitrc clean"?

Offline

#4 2010-08-01 15:35:20

iamsmrt
Member
Registered: 2009-08-12
Posts: 138

Re: [SOLVED] Need Help Remapping Caps Lock to Control

Anntoin wrote:

Its worth trying adding this to your xorg.conf:

Section "InputClass"
    Identifier "evdev keyboard catchall"
    MatchIsKeyboard "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    Option "XkbLayout" "gb"
    Option "XkbOptions" "ctrl:nocaps"
EndSection

I was having this problem for a while and this worked for me. Your mileage may vary.

This worked, thanks!

nixpunk wrote:
iamsmrt wrote:

I know I could do this by using xmodmap but I'd like to keep my .xinitrc clean/would just like to know why this isn't working.

I use xmodmap and it's quite easy to setup.  Just curious, but why exactly do you want to keep your ".xinitrc clean"?

My OCD more than anything big_smile

Offline

#5 2010-08-01 15:40:20

tom5760
Member
From: Philadelphia, PA, USA
Registered: 2006-02-05
Posts: 283
Website

Re: [SOLVED] Need Help Remapping Caps Lock to Control

I'd say using xmodmap is much more clean than screwing around with HAL and stuff like that.

Simply add the following to ~/.xmodmaprc

remove Lock = Caps_Lock
add Control = Caps_Lock

And then add to your startup programs (~/.xinitrc)

xmodmap ~/.xmodmaprx

Not sure how a bunch of XML is cleaner.  This way, you don't need to restart HAL or anything when you make a change.

EDIT: Also this way, you don't even need an /etc/X11/xorg.conf

Last edited by tom5760 (2010-08-01 15:41:42)

Offline

#6 2010-08-01 17:14:36

Proofrific
Member
Registered: 2008-01-05
Posts: 196

Re: [SOLVED] Need Help Remapping Caps Lock to Control

iamsmrt wrote:
Anntoin wrote:

Its worth trying adding this to your xorg.conf:

Section "InputClass"
    Identifier "evdev keyboard catchall"
    MatchIsKeyboard "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    Option "XkbLayout" "gb"
    Option "XkbOptions" "ctrl:nocaps"
EndSection

I was having this problem for a while and this worked for me. Your mileage may vary.

This worked, thanks!

Cool, I didn't know you could do that in xorg.conf.

It seems like you found the solution that you wanted.  Please prepend "[SOLVED]" at the beginning of the thread title.  Thanks!  That way, as people browse the forums to help people, they'll know that you already found a solution.

Offline

#7 2010-08-01 18:01:59

nixpunk
Member
Registered: 2009-11-23
Posts: 268

Re: [SOLVED] Need Help Remapping Caps Lock to Control

iamsmrt wrote:
nixpunk wrote:
iamsmrt wrote:

I know I could do this by using xmodmap but I'd like to keep my .xinitrc clean/would just like to know why this isn't working.

I use xmodmap and it's quite easy to setup.  Just curious, but why exactly do you want to keep your ".xinitrc clean"?

My OCD more than anything big_smile

Can't say I don't understand. wink

Offline

Board footer

Powered by FluxBB