Home_greyopenFATE - openSUSE feature tracking > #318355
Dashboard | Search | Sign up | Login

Please login or register to be able to edit or vote this feature.

Convert X keyboard layouts to console keymaps for languages with Latin characters

Feature state

openSUSE Distribution
Done
openSUSE Factory
Done

Description

In systemd world we use localectl.
Mapping between console and X keyboards is complicated.
I creates bugs (e.g. https://bugzilla.novell.com/show_bug.cgi?id=897803 ) after switching from legacy
/etc/X11/xdm/Keyboard.map
mapping in to new systemd
/usr/share/systemd/kbd-model-map
mapping.
Indeed most console keyboards are obsolete, they are difficult to configure, as each layout requires specific correct parameters for kbd_mode and setfont.
And YaST also have some additional mapping:
/usr/share/YaST2/data/keyboard_raw.ycp.
We must change essentially keyboard management in YaST.
We could use Fedora solution by converting X keymaps to console keymaps to simplify keyboard issues.

Usecase

As discussed in https://bugs.freedesktop.org/show_bug.cgi?id=88545 , Fedora has many more console layouts, converted from X keyboard layouts with script: # Convert X keyboard layouts to console keymaps mkdir -p $RPM_BUILD_ROOT/lib/kbd/keymaps/xkb perl xml2lst.pl < /usr/share/X11/xkb/rules/base.xml > layouts-variants.lst while read line; do XKBLAYOUT=`echo "$line" | cut -d " " -f 1` echo "$XKBLAYOUT" >> layouts-list.lst XKBVARIANT=`echo "$line" | cut -d " " -f 2` ckbcomp "$XKBLAYOUT" "$XKBVARIANT" | gzip > $RPM_BUILD_ROOT/lib/kbd/keymaps/xkb/"$XKBLAYOUT"-"$XKBVARIANT".map.gz done < layouts-variants.lst # Convert X keyboard layouts (plain, no variant) cat layouts-list.lst | sort -u >> layouts-list-uniq.lst while read line; do ckbcomp "$line" | gzip > $RPM_BUILD_ROOT/lib/kbd/keymaps/xkb/"$line".map.gz done < layouts-list-uniq.lst Full spec file: https://apps.fedoraproject.org/packages/kbd/sources/spec/

Fedora moved upstream layouts to /usr/lib/kbd/keymaps/legacy/ .

Discussion


icons/user_comment.png S. D. wrote: (2 years ago)

Finally I found the time to work on this. :-) Current result you can find in obs://home:sndirsch:Fate #318355. I've created a console-setup package, since SUSE was still lacking the ckbcomp tool to convert xkeyboard-layout keymaps to console keymaps. I've adjusted kbd package to convert xkeyboard-layout keymaps to console keymaps, which makes use of this tool. Original kbd keymaps I've moved to legacy directory and now they are last in loadkeys' search path, i.e. xkb converted ones are preferred. Also in kbd package I've created additional entries for systemd's mapping console keymap <-> X keymap. In systemd package I append these entries to systemd's /usr/share/systemd/kbd-model-map table. What's still missing are the adjustments in YaST. Do we want to adjust YaST in a way so the existing console keymaps are replaced with the converted xkb keymaps? Or do we want to add new entries to the YaST list and still use the old legacy keymaps for the current list? Or maybe both? I'm not sure here. Seems there are 3 files, which need adjustments. lang2keyboard.ycp, xkblayout2keyboard.ycp, keyboard_raw.ycp in /usr/share/YaST2/data. Not sure how these are connected togehter exactly. I would like to see a proposal here preferrably by the YaST developer(s). Mapping table console keyboard <-> X keyboard is now available in systemd's /usr/share/systemd/kbd-model-map. Everything YaST specific can now be based on that information.

icons/user_comment.png S. D. wrote: (2 years ago)

Jiri Suchomel. I've found your email address in lang2keyboard.ycp. Can you help here?

icons/user_comment.png J. S. wrote: (2 years ago)

I've already asked for this years ago in Fate #309487.

So I think it's good there's time for it now. However, I'm not yast2-country maintainer any more. Please ask Jiri Srain or Lukas who should work on YaST side of this.

icons/user_comment.png S. D. wrote: (2 years ago)
> Hope you didn't miss FATE#318426. A feature often requested by YaST 
> development and finally being possible to implement. But now I would need the
> input of YaST developers (see my comment #15). Without your input I don't know
> how to continue there. :-(
>
> Also I don't know what all these different keyboad mapping variants mean in
> keyboard_raw.ycp. Apart from the "pc104" there is also "macintosh", "type4",
> "type5", "type5_euro". Are they still being used by YaST?
>
> Any help would be appreciated.
Hi Stefan,I'm also adding Ancor, who has changed the code recently and
(Major) part of the current implementation has been created by Jiri
Suchomel, so I believe he'll be so kind and answer your questions.
Moreover, I'm also adding Ancor, who has changed the code recently and
thus should also have a knowledge about the implementation there.
Bye
Lukas Ocilka, Systems Management (Yast) Team Leader
icons/user_comment.png M. B. wrote: (2 years ago)

Nice to hear, that the is progress.
I hope in openSUSE Leap 42.1 YaST will provide selection of keyboard layouts, that are X and console compatible (i.e. using console keymaps, converted from X).

icons/user_comment.png S. D. wrote: (2 years ago)

Good news. Everything is now put in place for tumbleweed, i.e. package change requrests done (console-setup, kbd, systemd, yast2-country and yast2-x11). Once this is in and has been tested we can continue with Leap/42, then sle12-sp2.

icons/user_comment.png M. B. wrote: (2 years ago)

As I see in
https://build.opensuse.org/package/rdiff/YaST:Head/yast2-country?linkrev=base&rev=344 there is no new keymaps for selection. Can we include all keymaps for selection in YaST, not only ~50. I suggest we can use two columns: one for layouts, one (regenerated after changes in first column) for variants.

We may also follow Fedora and patch converted keyboards: at this moment latest Fedora's kbd package will rename fi.map to fi-kotoistus.map, add compose rules to cz layout. See
https://apps.fedoraproject.org/packages/kbd/sources/spec and
https://apps.fedoraproject.org/packages/kbd/sources/patches

icons/user_comment.png S. D. wrote: (2 years ago)

Right. We didn't add more keymaps for selection to YaST. More than one keyboard layout per language (with some exceptions) would overburden most of our users, let alone introducing a choosable combination of layout + variant. The changes I did for kbd/systemd didn't land yet in factory. See https://build.opensuse.org/request/show/322479 and https://build.opensuse.org/request/show/323880. Let me know what's still missing there. Submit for yast2-x11 is also still pending. See https://build.opensuse.org/request/show/324126.

icons/user_comment.png M. B. wrote: (2 years ago)

Or maybe can we can implement two modes? 1) select from basic layout (~50) and 2) select from all layouts. Modes could be switched by tab, or by radio button, or by pressing existing "Expert settings" button or by new separate "Details..." button.

icons/user_comment.png M. B. wrote: (2 years ago)

I opened new kbd package and I see, that fi.map is already renamed to fi-kotoistus.map. But there is still some jobs, that Fedora do:

  • rename dublicated (existing in both kbd and kbd-legacy) layouts, e.g.

mv olpc/pt.map olpc/pt-olpc.map

  • sr-cy copy to i386/qwerty/sr-latin
  • add compose rules to cz layout
icons/user_comment.png M. B. wrote: (2 years ago)

I was wrong by saying "rename dublicated (existing in both kbd and kbd-legacy) layouts". Fedora only "Rename conflicting keymaps" (
https://apps.fedoraproject.org/packages/kbd/sources/spec ):

          mv dvorak/no.map dvorak/no-dvorak.map 
mv fgGIod/trf.map fgGIod/trf-fgGIod.map
mv olpc/es.map olpc/es-olpc.map
#already done in our kbd
mv olpc/pt.map olpc/pt-olpc.map
mv qwerty/cz.map qwerty/cz-qwerty.map
icons/user_comment.png M. B. wrote: (2 years ago)

in last message "#already done in our kbd " was for "mv olpc/es.map olpc/es-olpc.map" only

icons/user_comment.png S. D. wrote: (2 years ago)

Mindaugas, before I get anything wrong. Could you do me a favor and make a submitrequest for the remaining changes against home:sndirsch:Fate #318355/kbd? That's the project, which I use for the development of this FATE request.

icons/user_comment.png M. B. wrote: (2 years ago)

OK, you will find submit
request 324843

We may also update kbd from 2.0.2 to 2.0.3.

If any, in future you can look at history of Fedora's kbd package in git also:
http://pkgs.fedoraproject.org/cgit/kbd.git/log/

icons/user_comment.png S. D. wrote: (2 years ago)

Thanks. Accepted and forwarded to Base:System, from where it hopefully be forwarded to factory once accepted. I'm aware of the git repo for the RH package sources. ;-)

icons/user_comment.png S. D. wrote: (2 years ago)

Adding YaST developer.

icons/user_comment.png M. B. wrote: (2 years ago)

I a bit tested current versions of packages.
I noticed, that in YaST2 marking layout, immediately also changes keyboard layout of all my desktop. I suggest, YaST should isolate this change only for YaST keyboard selection dialog for testing.
Some layout selections causes to use US layout: Greek, Russian, Serbian (and also Khmer, Simplified and Traditional Chinese - these seems to be intentionally fallbacks to US). Ukrainian keyboard seems wrong at all - it don't change layout to any layout.
YaST stores changes (at least in) /etc/sysconfig/keyboard file (YAST_KEYBOARD variable), but here is obsolele KEYTABLE variable.

Changes in YaST don't affect /etc/sysconfig/console variables variables. As we use converted X layout, we need reset them? Or maybe they are obsolete also?

icons/user_comment.png M. B. wrote: (2 years ago)

Ech.. I installed some wrong version of YaST package... Reinstalled.
Greek and Serbian seems good. Russian fallbacks to US. Ukrainian keyboard still seems wrong at all - it don't change layout to any layout.

icons/user_comment.png M. B. wrote: (2 years ago)

Played a bit more...

/etc/sysconfig/console variables is indeed important in terminal (then go by Ctrl+Alt+F1)!

We must:

  • clear CONSOLE_UNICODEMAP, CONSOLE_SCREENMAP and CONSOLE_MAGIC variables
  • set CONSOLE_ENCODING="UTF-8"
  • not sure, which CONSOLE_FONT should be used
icons/user_comment.png M. B. wrote: (2 years ago)

At least with lt and lt-std keymaps, best console fonts are lat4-16 and lat4a-16

icons/user_comment.png M. B. wrote: (2 years ago)

More findings:
Fedora seems to use eurlatgr console font, that covers LatArCyrHeb and plus provides more special characters (according to https://fedoraproject.org/wiki/Changes/NewDefaultConsoleFont ). openSUSE has eurlatgr console font as file:///usr/share/kbd/consolefonts/eurlatgr.psfu.gz
I tested it and it seems the best one! Even ←↓↑→ characters are displayed in console with this font. I suugest, we also must set
/etc/sysconfig/console CONSOLE_FONT="eurlatgr"

icons/user_comment.png M. B. wrote: (2 years ago)

EurLatGr provides greater coverage for Latin and Greek characters, but at the cost of Arabic, Cyrillic and Hebrew characters being dropped. So we can use LatArCyrHeb-16 (or LatArCyrHeb-14) font for layouts with Arabic, Cyrillic and Hebrew characters.

icons/user_comment.png S. D. wrote: (2 years ago)

I believe changing the marking layout immediately is intentional behaviour by YaST, but Ancor can comment on this. Also you cannot change the keyboard layout only for the current YaST window (limitation of X). So for now we cannot change this.

Russian falls back to "us,ru", i.e. "us" is first and can be switched to "ru" by using Shift-Shift. I didn't want to change this, since 1) we had issues in the past when using "ru,us" instead (switching didn't work too well), 2) users are running into issues when trying to enter the ASCII password in displaymanager.

Ukraine keyboard: We never had a working mapping from Linux console to X11. We definitely should fix it though. Please open a bug for this making sure adding me and Ancor to this bug.

Indeed KEYTABLE variable in /etc/sysconfig/keyboard is obsolete. YaST now writes KEYMAP variable directly to /etc/vconsole. During displaymanager startup /etc/X11/xdm/keytable creates the required /etc/X11/xorg.conf.d/90-keytable.conf snippet by using systemd's localectl command.

About changing the console font. Your propsal sounds reasonable to me, but is unrelated to this FATE request. Please open a bug for this as well again making sure to add me and Ancor to this bug.

Thanks for prompt and thouroughly testing. Very much appreciated!

icons/user_comment.png M. B. wrote: (2 years ago)
Last change: 3 months ago
Voting
Score: 2
  • Negative: 0
  • Neutral: 0
  • Positive: 2
Feature Export
Application-xmlXML   Text-x-logPlaintext   PrinterPrint