Bug 1176302 - keyboard: Switch kbd keyboard defaults to xkb based ones
keyboard: Switch kbd keyboard defaults to xkb based ones
Status: IN_PROGRESS
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: YaST2
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: YaST Team
Jiri Srain
https://trello.com/c/WAlGLtnN
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-09-08 23:19 UTC by Stanislav Brabec
Modified: 2022-05-13 15:23 UTC (History)
6 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Brabec 2020-09-08 23:19:36 UTC
In past, kbd had its own keymaps with different names and layouts than xkb.

Several years ago we generated a set of new keymaps based on xkb keymaps, and moved old ones to the kbd-legacy sub-package.

But these keymaps are still not used by default.

To fix this situation, we have to:

1. Change YaST keymap selection. kbd keymap should have the same name as xkb keymap.

2a. Change keymap search path inside kbd. In case of name conflict prefer the one from /usr/share/kbd/keymaps/xkb.
or
2b. When YaST will pick keymap, it will use fully qualified path.
I would prefer 2a.

3. Write a migration %post script that will perform one-shot migration of legacy keymaps to xkb ones. (I will just fetch the history of keyboard/src/data/keyboards.rb

4. Remove kbd-legacy from the default installation.
Comment 1 Stefan Schubert 2020-09-10 08:27:30 UTC
(In reply to Stanislav Brabec from comment #0)
> In past, kbd had its own keymaps with different names and layouts than xkb.
> 
> Several years ago we generated a set of new keymaps based on xkb keymaps,
> and moved old ones to the kbd-legacy sub-package.
> 
> But these keymaps are still not used by default.
> 
> To fix this situation, we have to:
> 
> 1. Change YaST keymap selection. kbd keymap should have the same name as xkb
> keymap.

Could you please give us some examples in order to see where it should be done ?
Comment 2 Stanislav Brabec 2020-09-16 00:02:03 UTC
1. country/keyboard/src/data/keyboards.rb
It could need some editing in other files, as you don't want to duplicate map names, but use xkb names directly.

2a. My task.

2b. Wherever loadkeys is called. (But I plan to implement 2a, so there is no need for fully qualified path.)

3. Either kbd package or yast2-country.

4. Not sure which package handles that. patterns?
Comment 3 Stanislav Brabec 2020-09-17 15:09:50 UTC
Regarding 2a: There is already a patch for it: kbd-1.15.5-loadkeys-search-path.patch from Stefan Dirsch.

But it does not work as expected:

static const char *const dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", DATADIR "/" XKBKEYMAPDIR "/", DATADIR "/" LEGACYKEYMAPDIR "/**", KERNDIR "/", 0 };
...
#define KEYMAPDIR "keymaps"
#define XKBKEYMAPDIR "keymaps/xkb"
#define LEGACYKEYMAPDIR "keymaps/legacy"

=> First, any directory in keymapdir is searched, then xkb dir, then legacy => The result is undefined.

2a is fixed: https://build.opensuse.org/request/show/835238

2b is not needed to implement.
Comment 4 Stefan Dirsch 2020-09-17 16:30:35 UTC
I feel sorry to have broken this! :-( I meanwhile even no longer can remember having written this patch, but apparently I did.

-------------------------------------------------------------------
Fri Jul 17 12:54:27 UTC 2015 - sndirsch@suse.com

- Include xkb layouts from xkeyboard-config converted to console
  keymaps, (FATE#318426)
  * Rename Finnish xkb converted layout
  * Add xkb and legacy keymaps subdirs to loadkyes search path
    (kbd-1.15.5-loadkeys-search-path.patch), remove symlinks,
    Don't convert layouts that can't input ASCII,
  * Original keymaps moved to legacy dir, created symlinks to xkb
    keymaps
Comment 5 Stanislav Brabec 2020-09-18 16:07:54 UTC
Stefan Dirsch: I guess that you did the whole xkb to kbd keymap generation. The search path was just a minor part of this work.

Until now, we were using legacy keyboards by default, so the current behavior was OK.
Comment 6 Stefan Dirsch 2020-09-23 12:51:20 UTC
I guess you no longer need me here. Otherwise please free to readd me. But then also tell me why and how I can help you. ;-)
Comment 7 Stanislav Brabec 2020-09-23 21:06:52 UTC
I would like to prepare a migration script for kbd, but I don't know the mechanism of assigning the locale default keymap in X. Could you give me a hint? Is it done by YaST during installation, by a display manager or by GNOME/KDE?
Comment 8 Martin Vidner 2021-07-27 14:05:19 UTC
> the mechanism of assigning the locale default keymap in X

I'm not sure what you mean. Can you explain a bit, with an example?

Also note that YaST internally uses some of the legacy keyboard names, which bleed over to systemd.rpm: /usr/share/systemd/kbd-model-map built from kbd-model-map.legacy
Comment 9 Stanislav Brabec 2021-08-25 17:17:24 UTC
If the user selects e. g. Czech language and Czech keyboard in the YaST installation, display manager will probably switch to the Czech keymap, and the default for users will be Czech keymap as well.
 during the installation
However I don't know, where these default keymaps are encoded. Do they come from YaST? Or they are built-in into GDM or any other GNOME tool?