Hi Karl,
Thanks for looking at my code.
Karl Godt wrote:If i issue
setxkbmap -rules xorg -model pc102 -layout us,de -variant ",alt-intl" -option grp:rwin_toggle,lv3:ralt_switch
in terminal
i get
Error loading new keyboard description
The order of the variant list is important. It needs to be in the same order as the layout list. The initial comma in ",alt-intl" indicates that the first field is empty. So no variant is assigned to the first layout. The second variant is assigned to the second layout.
So
setxkbmap tries to assign the alt-intl variant to the de layout. But there is no such variant defined for the de layout, so you get an error message.
Karl Godt wrote:setxkbmap -rules xorg -model pc102 -layout us,de -variant "alt-intl" -option grp:rwin_toggle,lv3:ralt_switch
works ok .
Yes. Now
setxkbmap tries to assign the alt-intl variant to the us layout, which is a valid combination, so it succeeds.
Using
-layout de,us -variant ",alt-intl" is also legal.
Karl Godt wrote:+++ new/XkbLayoutConfig
probably needs to be
Code: Select all
+ VARIANTS=`echo "$VARIANTS" | sed 's/^,//;s/,$//'`
The purpose of that line is only to remove a trailing comma that gets added as a result of the
echo command in the previous line. This code is adapted from a line in
XkbVariantConfig. In theory, I could have eliminated the need for this line by using
echo -n instead of
echo, but the original author left a warning in the code:
#the last sed is since we need to cut off the last , (echo -n doesn't work well)
So I decided to heed that warning.
Anyway, no extra comma is added at the start of the list, so there is no need for the
s/^,// here.
Karl Godt wrote:EXPECTED RESULTS:
"intl" variant should have been removed from "XkbVariant" line.
Don't know if it should have been removed
The steps listed for reproducing bug #3, using the original
XkbLayoutConfig results in these lines being placed in xorg.conf:
Code: Select all
Option "XkbLayout" "be" #xkeymap0
Option "XkbVariant" "intl,"
The intl variant was assigned to the us layout, but the us layout has been removed, so its variant should be removed as well. When
XkbApplyNow passes those two lists to
setxkbmap, that utility will be unhappy with the trailing comma because this makes the variant list have two fields while the layout list has only one field. No variant will be loaded.
Even if
setxkbmap wasn't unhappy with that comma, it would be unhappy with trying to assign a variant named "intl" to the layout named "be", because there is no "intl" variant for the "be" layout.
Karl Godt wrote:but to toggle
Option "XkbOptions" "lv3:ralt_switch,grp:rwin_toggle"
the keyboard layout
Option "XkbLayout" "de,us" #xkeymap0
does not work having two variants here
Option "XkbVariant" "deadgraveacute,alt-intl"
Oh, that's interesting.
I haven't been able to test with
grp:rwin_toggle, since I don't have a right Windows key on my laptop, but when I test with
grp:lwin_toggle I do have trouble.
For me it loads the German layout OK, and pressing the left Windows key does, in fact, switch to the US layout. But it will not switch back again if I press the key again. Is that the same symptom that you had?
Anyway, the symptom I see doesn't seem to be related to the variants. It acts the same if I don't load any variants at all.
The funny thing is that it
is happy if I reverse the order of the layouts and variants, like so:
Code: Select all
Option "XkbLayout" "us,de" #xkeymap0
Option "XkbVariant" "alt-intl,deadgraveacute"
Option "XkbOptions" "lv3:ralt_switch,grp:lwin_toggle"
Also, setting the left Ctrl+Shift keys for toggling the group works with the original order:
Code: Select all
Option "XkbLayout" "de,us" #xkeymap0
Option "XkbVariant" "deadgraveacute,alt-intl"
Option "XkbOptions" "lv3:ralt_switch,grp:ctrl_shift_toggle"
And using the left Windows key as a temporary switch, not a toggle, also responds properly:
Code: Select all
Option "XkbLayout" "de,us" #xkeymap0
Option "XkbVariant" "deadgraveacute,alt-intl"
Option "XkbOptions" "lv3:ralt_switch,grp:lwin_switch"
(Rember to switch your keyboard group back to the first layout before removing a group toggle. If you don't you will be stuck in another layout until you add a new group toggle.)
Things are a bit flaky. When I first tried
grp:lwin_switch, it worked fine. When I tried later it didn't work until I tried
grp:win_switch. Then
grp:lwin_switch worked again. And
grp:lwin_toggle no longer lets me toggle even once, as it did when I first tried it.
Anyway, you have clearly found a bug (assuming I am seeing the same symptom as you). Since I am able to reproduce it by using
setxkbmap without involving the
XKB Configuration Manager, it would seem that the bug is not in the
XKB Configuration Manager, but further downstream (possibly in
xkbcomp, the keyboard definition files, or the X server itself).
Thanks again for taking the time for looking at this.
P.S. Karl, I just saw a new reply from you come in. Thanks for testing. Glad the diffs worked for you. I'll read your new message over and get back to you later.