I type with the dvorak keyboard layout. It would be handy if I could change CapsLock (which I never use) to be QwertyLock. Using xkbcomp, I was able to get an xkb file that almost works:

type "QWERTYCAPS" {
  modifiers= Shift+Lock;
  map[Shift]= Level2;
  map[Lock]= Level3;
  map[Shift+Lock]= Level4;
  level_name[Level1]= "Base";
  level_name[Level2]= "Caps";
  level_name[Level3]= "Qwerty";
  level_name[Level4]= "QwertyCaps";
};
...
key <AC01> {
  type= "QWERTYCAPS",
  symbols[Group1]= [ a, A, a, A ]
};
key <AC02> {
  type= "QWERTYCAPS",
  symbols[Group1]= [ o, O, s, S ]
};

This works except for the two letters 'a' and 'm', which are in the same position in qwerty and dvorak. Apparently there is some special magic in xkb that changes the interpretation if the letter is the same with and without CapsLock. So, despite what I asked, I got:

Mod normal, shift, caps, shift+caps
Ask a, A, a, A
Got a, A, A, A

So, the CapsLock case is uppercase despite asking for lowercase. In fact, changing letter from either the normal or caps case makes it give the requested character.

Is there a way to override this behavior so I get a lowercase 'a'? Failing that, what is the right approach? I see that there are groups, so I could make qwerty group2. But, then I'd have to change CapsLock into GroupLock. I tried that briefly as an experiment, but it didn't work, and the CapsLock indicator didn't turn on either.

So, what is the easiest way to get QwertyLock?

有帮助吗?

解决方案

setxkbmap -layout us,us -variant ,dvorak -option grp:caps_toggle

Or the same thing in the config file (/etc/X11/xorg.conf.d/10-keyboard.conf):

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,us"
        Option "XkbModel" "pc104"
        Option "XkbVariant" ",dvorak"
        Option "XkbOptions" "grp:caps_toggle"
EndSection
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top