sergei-mironov / xkb-switch

Switch your X keyboard layouts from the command line
MIT License
345 stars 37 forks source link

Group vs layout disambiguation #45

Open LeMikaelF opened 4 years ago

LeMikaelF commented 4 years ago

It seems that this tool uses the word "group" to refer to what xkb calls "layout", which are complete keybard mapping. Here's the—admittedly confusing—definition of a group from the XKB Configuration Guide (emphasis mine):

You can use multi-layouts xkb configuration. What does it mean? Basically it allows to load up to four different keyboard layouts at a time. Each such layout would reside in its own group. The groups (unlike complete keyboard remapping) can be switched very fast from one to another by a combination of keys.

It would be very interesting if this tool could also change groups, as xkb's group-changing mechanism is somewhat limited (it requires you to reserve a key for only this purpose) and doesn't seem to be accessible from setxkbmap. If this isn't an option, then maybe the docs could adopt the xkb terminology ("layout").

sergei-mironov commented 4 years ago

Hi. Sorry for delay. The definitions of group/layout is in fact a mystery for me, but thank you for the docs link.

I see that xkb-switch does read 'layouts' from X configuration by parsing keyboard properties here, but then it switch groups by calling XkbLockGroup function here. It may be that by that we explicitly assume a specific configuration (1-to-1 layout/group mapping) which is only a subset of all possible configurations. So it may be not only a documentation problem :) Could you suggest a more detailed explanation of group-layout relationship?

Also, someone asked me to introduce a memory in layout switching, so I wrote the xkb-group.sh script. It switches layouts from the current one to previously used, and back. What do you think, does it have a connection with xkb 'groups' term, as mentioned in docs?

I agree that documentation should use xkb terms. I am ready to fix it once I understand the problem.