You are not logged in.

#1 2019-08-14 16:20:38

Fabius
Member
Registered: 2019-05-21
Posts: 5

[SOLVED] xmodmap - remap Caps_Lock to Esc and S+Caps_Lock to Caps_Lock

I'm experiencing a strange behavior with xmodmap. I want to remap Caps_Lock so it acts as Escape and Shift+Caps_Lock so it acts as Caps_Lock. In my ~/.Xmodmap i tried every possible combination of the following commands always with the same result:

clear Lock
remove Lock = Caps_Lock
keycode 66 =
keycode 66 = Escape Caps_Lock
keysym Caps_Lock = Escape Caps_Lock

The Caps_Lock gets properly remapped to Escape

$ xmodmap -pke | grep Caps
keycode  66 = Escape Caps_Lock Escape Caps_Lock

BUT after reboot it still does lock CAPS. So it acts as both Escape and Caps_Lock.

Running xev i can see that the state switches between 0x10 and 0x12. While Shift+Caps_Lock works as expected (as Caps_Lock).

If i run xmodmap ~/.Xmodmap in my terminal after logging in i get this as before:

$ xmodmap -pke | grep Caps
keycode  66 = Escape Caps_Lock Escape Caps_Lock

BUT Caps_Lock starts behaving as expected, only as Escape and does no longer lock CAPS.

I really dont get what am i doing wrong. Anyone can help me figure it out?

Last edited by Fabius (2019-08-16 00:23:31)

Offline

#2 2019-08-14 18:00:01

Fabius
Member
Registered: 2019-05-21
Posts: 5

Re: [SOLVED] xmodmap - remap Caps_Lock to Esc and S+Caps_Lock to Caps_Lock

As soon as i posted i figured out that X keyboard extension yet offers an option for this.
By looking at /usr/share/X11/xkb/rules/base.lst i found the following line:

caps:escape_shifted_capslock Make unmodified Caps Lock an additional Esc, but Shift + Caps Lock behaves like regular Caps Lock

So i simply needed to add caps:escape_shifted_capslock to XkbOptions inside /etc/X11/xorg.conf.d/00-keyboard.conf this way:

Option "XkbOptions" "terminate:ctrl_alt_bksp,caps:escape_shifted_capslock"

After reboot Caps_Lock and Shift+Caps_Lock were behaving exactly the way i wanted.

Last edited by Fabius (2019-08-14 18:06:10)

Offline

#3 2019-08-14 20:40:21

seth
Member
Registered: 2012-09-03
Posts: 23,231

Re: [SOLVED] xmodmap - remap Caps_Lock to Esc and S+Caps_Lock to Caps_Lock

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

#4 2019-08-16 00:24:04

Fabius
Member
Registered: 2019-05-21
Posts: 5

Re: [SOLVED] xmodmap - remap Caps_Lock to Esc and S+Caps_Lock to Caps_Lock

seth wrote:

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Sure, done. Thanks for the advice.

Offline

Board footer

Powered by FluxBB