[Bug 1209594] New: 'localectl set-keymap' wipes xkboptions
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 Bug ID: 1209594 Summary: 'localectl set-keymap' wipes xkboptions Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: X.Org Assignee: gfx-bugs@suse.de Reporter: noreply.section+dev@gmail.com QA Contact: gfx-bugs@suse.de Found By: --- Blocker: --- As of TW 20230318, after updating to systemd-253, the file /etc/X11/xorg.conf.d/00-keyboard.conf is rewritten with default values on every graphic login, discarding saved xkb options. More precisely, I like to do:
localectl set-x11-keymap us pc104 '' compose:lwin
These settings are saved in /etc/X11/xorg.conf.d/00-keyboard.conf: Section "InputClass" Identifier "system-keyboard" MatchIsKeyboard "on" Option "XkbLayout" "us" Option "XkbModel" "pc104" Option "XkbOptions" "compose:lwin" EndSection as well as (I believe only starting from systemd-253) in /etc/vconsole.conf: KEYMAP=us FONT=eurlatgr.psfu XKBLAYOUT=us XKBMODEL=pc104 XKBOPTIONS=compose:lwin This is all fine. Unfortunately upon re-login all those settings are wiped out and replaced with defaults. I tried to find out why this happens and I think that "display-manager start" calls "/usr/etc/X11/xdm/keytable" calls "localectl set-keymap us" which wipes the settings. I think the behavior of "localectl" changed with systemd-253. As a possible workaround, the option --no-convert could be used in "/usr/etc/X11/xdm/keytable" like this:
localectl --no-convert set-keymap us
which would avoid the resetting of the xkb* values. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c1 Patrick Poitras <patrick.f.poitras@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |patrick.f.poitras@gmail.com --- Comment #1 from Patrick Poitras <patrick.f.poitras@gmail.com> --- Potentially related to the fix for this issue? https://github.com/systemd/systemd/pull/26182 -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c2 --- Comment #2 from Stefan Dirsch <sndirsch@suse.com> --- keytable only takes care of $KEYMAP $KEYMAP_TOGGLE variables in /etc/vconsole.conf. This is what YaST uses during installation. localectl set-keymap $KEYMAP $KEYMAP_TOGGLE (KEYMAP_TOGGLE is a second keymap) Some history rpm --changelog -q xdm [...] * Wed Oct 18 2017 sndirsch@suse.com - reintroduced /etc/X11/xdm/keytable script and the hook-up in /usr/lib/X11/display-manager to setup X11 keymaps, since YaST is not able to use localectl already during installation due to dbus and appropriate systemd services not running :-( (bsc#1046436) [...] * Mon Feb 06 2017 sndirsch@suse.com - no longer try to configure Linux console and X11 keymaps according to setting in /etc/vconsole.conf; this needs to be done via localectl by YaST itself now; /etc/X11/xdm/keytable removed and no longer invoked by /usr/lib/X11/display-manager (bnc#1023211) [...] * Thu Jan 29 2015 sndirsch@suse.com - /etc/X11/xdm/keytable" * improved warning message, when mapping for console keyboard doesn't exist (bnc#914880) I don't see why this would be a new issue for you, which came with a systemd update. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c3 --- Comment #3 from Stefan Dirsch <sndirsch@suse.com> --- (In reply to Patrick Poitras from comment #1)
Potentially related to the fix for this issue?
Definitely not. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c4 Stefan Dirsch <sndirsch@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |IN_PROGRESS --- Comment #4 from Stefan Dirsch <sndirsch@suse.com> --- I suggest to configure your keyboard as a user and not system-wide. Either with the graphical tool of your favorite desktop or directly via setxkbmap in your ~/.xinitrc. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 Stefan Dirsch <sndirsch@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - None |P3 - Medium -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c5 --- Comment #5 from Stefan Dirsch <sndirsch@suse.com> --- (In reply to Luca Billi from comment #0)
As a possible workaround, the option --no-convert could be used in "/usr/etc/X11/xdm/keytable" like this:
localectl --no-convert set-keymap us
which would avoid the resetting of the xkb* values.
Which would break things again. That's why I did * Wed Oct 18 2017 sndirsch@suse.com - reintroduced /etc/X11/xdm/keytable script and the hook-up in /usr/lib/X11/display-manager to setup X11 keymaps, since YaST is not able to use localectl already during installation due to dbus and appropriate systemd services not running :-( (bsc#1046436) We need this X11 keyboard config snippet. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c6 Stefan Dirsch <sndirsch@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|IN_PROGRESS |RESOLVED Resolution|--- |WONTFIX --- Comment #6 from Stefan Dirsch <sndirsch@suse.com> --- I don't plan to change this behaviour. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c7 Giorgio Gallo <giorgio.gallo@bitnic.it> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |giorgio.gallo@bitnic.it --- Comment #7 from Giorgio Gallo <giorgio.gallo@bitnic.it> --- To me it seems the issue seems to be that /usr/etc/X11/xdm/keytable is lacking in the way it calls localectl from the contents of /etc/vconsole.conf. Reading the script the author's intent seems to be "if vconsole.conf exists treat it as a source of truth and use localectl to make sure all the other configuration files are in line with vconsole.conf" (?), but the implementation ends up re-writing vconsole.conf itself at every reboot (which depending on sensibilities maybe be seen as an issue or mere lack of elegance) and, most importantly, resetting some of the variables in vconsole.conf to defaults. Here's some commands to understand what I mean: ~ ��� cat /etc/vconsole.conf KEYMAP=us-altgr-intl FONT=eurlatgr.psfu FONT_MAP= FONT_UNIMAP= XKBLAYOUT=us XKBMODEL=pc104 XKBVARIANT=altgr-intl XKBOPTIONS=compose:menu,terminate:ctrl_alt_bksp ~ ��� sudo /usr/etc/X11/xdm/keytable /etc/vconsole.conf available KEYMAP: us-altgr-intl Command: localectl set-keymap us-altgr-intl I: Using systemd /usr/share/systemd/kbd-model-map mapping ~ ��� cat /etc/vconsole.conf KEYMAP=us-altgr-intl FONT=eurlatgr.psfu FONT_MAP= FONT_UNIMAP= XKBLAYOUT=us XKBMODEL=microsoftpro XKBVARIANT=altgr-intl XKBOPTIONS=terminate:ctrl_alt_bksp (note that, while the keymap us-altgr-intl is correctly conserved, other variables in vconsole.conf are reset to default) -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c8 --- Comment #8 from Giorgio Gallo <giorgio.gallo@bitnic.it> --- Basically, /usr/etc/X11/xdm/keytable boils down to: source /etc/vconsole.conf localectl set-keymap $KEYMAP $KEYMAP_TOGGLE but it should instead be: source /etc/vconsole.conf localectl set-keymap $KEYMAP $KEYMAP_TOGGLE localectl set-x11-keymap $XKBLAYOUT $XKBMODEL $XKBVARIANT $XKBOPTIONS (to me it's not 100% clear what the suggested --no-convert does, so I'm leaving it out even if it does seem to solve the issue at hand) -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c9 --- Comment #9 from Giorgio Gallo <giorgio.gallo@bitnic.it> --- BTW: reading the keytable script, it seems like the checks under "check systemd mapping" will misbehave if KEYMAP_TOGGLE is present in vconsole.conf (because $1 will be something like "en it"; I didn't test this however) -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c10 Stefan Dirsch <sndirsch@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|WONTFIX |--- --- Comment #10 from Stefan Dirsch <sndirsch@suse.com> --- Ok. I think I can add this additional localectl set-x11-keymap $XKBLAYOUT $XKBMODEL $XKBVARIANT $XKBOPTIONS call if XKBLAYOUT is set. The chance for a regression is low since more or less nobody is trying to use "localectl set-x11-keymap ...". It's the first report I've seen since this script exists. BTW, localectl rewrites /etc/vconsole.conf itself. Don't try to figure out when. It's asynchron via a deamon and only does that if current keyboard config changes. No, not the one in /etc/vconsole.conf. Never ever try to write /etc/vconsole.conf yourself. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c11 Stefan Dirsch <sndirsch@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |IN_PROGRESS --- Comment #11 from Stefan Dirsch <sndirsch@suse.com> --- (In reply to Giorgio Gallo from comment #9)
BTW: reading the keytable script, it seems like the checks under "check systemd mapping" will misbehave if KEYMAP_TOGGLE is present in vconsole.conf (because $1 will be something like "en it"; I didn't test this however)
Indeed. The check fails, but just spits out a warnning. Ok. Apparently localectl set-keymap can only create a mapping for KEYMAP. Not sure why it then writes a KEYMAP_TOGGLE at all. Anyway, I will no longer use $KEYMAP_TOGGLE then. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c12 --- Comment #12 from Giorgio Gallo <giorgio.gallo@bitnic.it> --- (In reply to Stefan Dirsch from comment #10)
It's the first report I've seen since this script exists.
In fact, the issue must only existe since a few days: I use the compose key quite often so I'm pretty sure I've noticed as soon as I rebooted (IDK however if I rebooted right away after updating or precisely how long it was since I had last updated) Maybe some change that occurred elsewhere is affecting this -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c13 --- Comment #13 from Giorgio Gallo <giorgio.gallo@bitnic.it> --- This is /usr/etc/X11/xdm/keytable, rewritten with the logic "straightened up" in a way that IMHO makes it much more readable and with the additional "localectl set-x11-keymap". IDK if this rewrite is worth the hassle of testing and risk of regression... just including it in case it's of any use. #! /bin/bash if [ $UID -ne 0 ]; then echo "You need to be root to run this program" exit 0 fi vconsole_conf_file=/etc/vconsole.conf previous_x11conf_file=/etc/X11/xorg.conf.d/90-keytable.conf systemd_x11conf_file=/etc/X11/xorg.conf.d/00-keyboard.conf keyboard_map_systemd=/usr/share/systemd/kbd-model-map # Systamd's localectl replicates the keyboard configuration accross different # files ($vconsole_conf_file and, depending on version, $systemd_x11conf_file # or $previous_x11conf_file). # # To make sure it is consinstent everywhere, this scripts calls localectl with # the configuration from $vconsole_conf_file, which will cause the various # configuration files to be updated as neeeded. # # Moreover, this script also removes $previous_x11conf_file if it seems safe # to do so. if [ ! -f $vconsole_conf_file ]; then echo "$vconsole_conf_file not available" echo "Keyboard layout could not be set" exit 1 fi echo "$vconsole_conf_file available" . $vconsole_conf_file # sample variables loaded from $vconsole_conf_file: # KEYMAP=us-altgr-intl # FONT=eurlatgr.psfu # FONT_MAP= # FONT_UNIMAP= # XKBLAYOUT=us # XKBMODEL=pc104 # XKBVARIANT=altgr-intl # XKBOPTIONS=compose:menu,terminate:ctrl_alt_bksp if [ -z $KEYMAP ]; then echo "KEYMAP not set" echo "Keyboard layout could not be set" exit 1 fi echo "KEYMAP: $KEYMAP" if [ ! -f $systemd_x11conf_file ]; then localectl set-x11-keymap us fi opts=$(grep -P "^$KEYMAP\t" "$keyboard_map_systemd" | sed -re "s/[^\t]*//" -e "s/[\t]+/ /g" ) if [ -z "$opts" ]; then echo "W: Cannot find mapping for $KEYMAP in $keyboard_map_systemd" echo "W: This will result in an 'us' X keyboard layout as default" else echo "I: Using systemd $keyboard_map_systemd mapping" fi localectl set-keymap $KEYMAP $KEYMAP_TOGGLE if [ ! -z $XKBLAYOUT ]; then localectl set-x11-keymap $XKBLAYOUT $XKBMODEL $XKBVARIANT $XKBOPTIONS fi if [ ! -f $systemd_x11conf_file ]; then echo "$systemd_x11conf_file has not been created!" echo "Keyboard layout could not be set" ##### does this make sense here? exit 1 fi if [ -f $previous_x11conf_file ]; then if [ $systemd_x11conf_file -nt $previous_x11conf_file ]; then rm -f $previous_x11conf_file fi fi -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c14 --- Comment #14 from Luca Billi <noreply.section+dev@gmail.com> --- The issue started appearing only recently because localectl's behavior has changed. Currently, this command
localectl set-keymap $KEYMAP
is in fact equivalent to both
localectl set-keymap $KEYMAP localectl set-x11-keymap $XKBLAYOUT $XKBMODEL $XKBVARIANT $XKBOPTIONS
where the XKB* options are implicitly "converted" (inferred) from the value of $KEYMAP. The "--no-covert" option disable this automatic "conversion" between console and X11 keymaps. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c15 --- Comment #15 from Stefan Dirsch <sndirsch@suse.com> --- Hmm. I didn't plan to rewrite the script. Always room for regression there. :-( I 'm attaching a script you can give a try, which addresses the following: ------------------------------------------------------------------- Wed Mar 22 10:58:41 UTC 2023 - Stefan Dirsch <sndirsch@suse.com> - keytable: no longer ignore XKBLAYOUT (and XKBMODEL, XKBVARIANT, XKBOPTIONS) variables if available in /etc/vconsole.conf, i.e. no longer overwrite keyboard settings if anybody used "localectl set-x11-keymap" himself; fixed "check systemd mapping" if KEYMAP_TOGGLE has been set (boo#1209594) -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c16 --- Comment #16 from Stefan Dirsch <sndirsch@suse.com> --- Created attachment 865738 --> http://bugzilla.opensuse.org/attachment.cgi?id=865738&action=edit keytable -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c17 --- Comment #17 from Stefan Dirsch <sndirsch@suse.com> --- Created attachment 865739 --> http://bugzilla.opensuse.org/attachment.cgi?id=865739&action=edit Changes Just in case anybody wants to look at the changes ... -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c18 Stefan Dirsch <sndirsch@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |noreply.section+dev@gmail.c | |om Flags| |needinfo?(noreply.section+d | |ev@gmail.com) --- Comment #18 from Stefan Dirsch <sndirsch@suse.com> --- @Luca Please test. I suggest to test it the following way localectl set-keymap de # check /etc/vconsole.conf and /usr/etc/X11/xorg.conf.d/00-keyboard.conf localectl set-x11-keymap us pc104 '' compose:lwin # check /etc/vconsole.conf and /usr/etc/X11/xorg.conf.d/00-keyboard.conf sudo sh ./keytable # check /etc/vconsole.conf and /usr/etc/X11/xorg.conf.d/00-keyboard.conf Do not edit /etc/vconsole.conf manually for testing! For changing things run localectl set-keymap/set-x11-keymap with different keyboard layouts! -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c19 --- Comment #19 from Giorgio Gallo <giorgio.gallo@bitnic.it> --- Stefan, the "normal" way for the keytable script to exit is trough the "exit 0" in the setkeyboard function. After reaching that point execution does not go on and so the "localectl set-x11-keymap" you added is never executed (well, not if "keytable" executes normally). -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c20 --- Comment #20 from Stefan Dirsch <sndirsch@suse.com> --- Ouch. Missed this. :-( I'll attach an updated script. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c21 Stefan Dirsch <sndirsch@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #865738|0 |1 is obsolete| | --- Comment #21 from Stefan Dirsch <sndirsch@suse.com> --- Created attachment 865742 --> http://bugzilla.opensuse.org/attachment.cgi?id=865742&action=edit keytable -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c22 --- Comment #22 from OBSbugzilla Bot <bwiedemann+obsbugzillabot@suse.com> --- This is an autogenerated message for OBS integration: This bug (1209594) was mentioned in https://build.opensuse.org/request/show/1073786 Factory / xdm -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c23 --- Comment #23 from Giorgio Gallo <giorgio.gallo@bitnic.it> --- This one "works on my machine": I put it into my /usr/etc/X11/xdm/ and, after rebooting, my keyboard settings still survive. It must be noted that, if XKBLAYOUT is set, /etc/vconsole.config is now consistently rewritten twice at every boot (first "localectl set-keymap ..." mangles it just as it did before, and then "localectl set-x11-keymap ..." restores it to what it was). Also... the script's logic is now even more unnecessarily convoluted now than it was before :) -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c24 --- Comment #24 from Luca Billi <noreply.section+dev@gmail.com> --- Sorry to start sounding like a broken record but I'd like to reiterate that set-keymap and set-x11-keymap are not orthogonal but they overstep each other: they BOTH change all XKB* variables *and* KEYMAP. Unless the toggle "--no-convert" is used that is. Namely, if a user has configured KEYMAP != XKBLAYOUT, no sequence of set-keymap / set-x11-keymap will ever be able to reproduce that configuration and the user settings will be inevitably overidden. That is not my case but I'm just pointing out a limitation of the current approach. Taking a step back, I don't know about the big picture but I'm wondering about the role of the script "keytable". If it is to just provide sensible defaults in case some settings are missing, maybe this logic might do the trick: if KEYMAP and XKBLAYOUT are defined do nothing (and preserve user settings) else if KEYMAP is defined but not XKBLAYOUT set-keymap KEYMAP (which will also implicitly set XKB*) else do nothing (current behavior) fi -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c25 --- Comment #25 from Stefan Dirsch <sndirsch@suse.com> --- (In reply to Giorgio Gallo from comment #23)
This one "works on my machine": I put it into my /usr/etc/X11/xdm/ and, after rebooting, my keyboard settings still survive.
Thanks for testing!
It must be noted that, if XKBLAYOUT is set, /etc/vconsole.config is now consistently rewritten twice at every boot (first "localectl set-keymap ..." mangles it just as it did before, and then "localectl set-x11-keymap ..." restores it to what it was).
Well, this only happens if there is XKBLAYOUT set in /etc/vconsole.conf. Which only happens if someone is running localectl set-x11-keymap ... the only person doing this I'm aware of until now is our reporter Luca Billi. ;-)
Also... the script's logic is now even more unnecessarily convoluted now than it was before :)
Well, I didn't see this 'exit 0' immediately. This made it more complicated now. :-( -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c26 --- Comment #26 from Stefan Dirsch <sndirsch@suse.com> --- (In reply to Luca Billi from comment #24)
Sorry to start sounding like a broken record but I'd like to reiterate that set-keymap and set-x11-keymap are not orthogonal but they overstep each other: they BOTH change all XKB* variables *and* KEYMAP.
That's how mapping between Linux console and X11 keyboard is currently.
Unless the toggle "--no-convert" is used that is.
Well, but we need the convert for YaST (from Linux console to X11 at least)
Namely, if a user has configured KEYMAP != XKBLAYOUT, no sequence of set-keymap / set-x11-keymap will ever be able to reproduce that configuration and the user settings will be inevitably overidden.
That is not my case but I'm just pointing out a limitation of the current approach.
Well, who wants that. Different Linux console keyboard and defaultl X11 keyboard setting?
Taking a step back, I don't know about the big picture but I'm wondering about the role of the script "keytable".
The main purpose of this script is to finish what YaST fails to do during installation. * Wed Oct 18 2017 sndirsch@suse.com - reintroduced /etc/X11/xdm/keytable script and the hook-up in /usr/lib/X11/display-manager to setup X11 keymaps, since YaST is not able to use localectl already during installation due to dbus and appropriate systemd services not running :-( (bsc#1046436) I already killed it before, but I needed to revive it. :-(
If it is to just provide sensible defaults in case some settings are missing, maybe this logic might do the trick:
if KEYMAP and XKBLAYOUT are defined do nothing (and preserve user settings)
else if KEYMAP is defined but not XKBLAYOUT set-keymap KEYMAP (which will also implicitly set XKB*)
else do nothing (current behavior) fi
Yes, that may work. Haven't tested this though. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c27 --- Comment #27 from Stefan Dirsch <sndirsch@suse.com> --- (In reply to Stefan Dirsch from comment #26)
If it is to just provide sensible defaults in case some settings are missing, maybe this logic might do the trick:
if KEYMAP and XKBLAYOUT are defined do nothing (and preserve user settings)
else if KEYMAP is defined but not XKBLAYOUT set-keymap KEYMAP (which will also implicitly set XKB*)
else do nothing (current behavior) fi
Yes, that may work. Haven't tested this though.
Implemented this now. Will attach it in a minute. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c28 --- Comment #28 from Stefan Dirsch <sndirsch@suse.com> --- Created attachment 865746 --> http://bugzilla.opensuse.org/attachment.cgi?id=865746&action=edit keytable Changes to the original became minimal: @@ -11,7 +11,7 @@ keyboard_map_systemd=/usr/share/systemd/kbd-model-map function setkeyboard { - echo "Command: localectl set-keymap $1" + echo "Command: localectl set-keymap $1 $2" # xorg.conf.d snippet is only written if a valid snippet is already # available, so create an us sample if neccessary if [ ! -f $systemd_x11conf_file ]; then @@ -28,7 +28,7 @@ echo "I: Using systemd $keyboard_map_systemd mapping" fi - localectl set-keymap $1 + localectl set-keymap $1 $2 if [ -f $systemd_x11conf_file ]; then if [ -f $previous_x11conf_file ]; then if [ $systemd_x11conf_file -nt $previous_x11conf_file ]; then @@ -45,9 +45,14 @@ echo "$vconsole_conf_file available" . $vconsole_conf_file if [ ! -z $KEYMAP ]; then - echo "KEYMAP: $KEYMAP" - options="$KEYMAP $KEYMAP_TOGGLE" - setkeyboard "$options" + if [ -z $XKBLAYOUT ]; then + echo "KEYMAP: $KEYMAP" + setkeyboard $KEYMAP $KEYMAP_TOGGLE + else + echo "XKBLAYOUT: $XKBLAYOUT" + echo "XKBLAYOUT is already set. Better don't touch X11 keyboard configuration." + exit 0 + fi else echo "KEYMAP not set" fi -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c29 --- Comment #29 from Luca Billi <noreply.section+dev@gmail.com> ---
Created attachment 865746 [details] keytable
Works for me. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c30 --- Comment #30 from Giorgio Gallo <giorgio.gallo@bitnic.it> ---
Which only happens if someone is running localectl set-x11-keymap ... the only person doing this I'm aware of until now is our reporter Luca Billi. ;-)
For what may be worth, I'm using that too :) I find localectl is the easiest way to configure the keyboard from scripts and such (I maintain an ansible thing to configure my PCs). Of course, even among the nerds who may use anisble, most people just pick a keyboard layout (say, "en" or "de") without setting any "advanced" option, but.. I'm with you, Luca!
Namely, if a user has configured KEYMAP != XKBLAYOUT, no sequence of set-keymap / set-x11-keymap will ever be able to reproduce that configuration and the user settings will be inevitably overidden.
It's not exactly like that... for example, I have: ��� cat /etc/vconsole.conf KEYMAP=us-altgr-intl FONT=eurlatgr.psfu FONT_MAP= FONT_UNIMAP= XKBLAYOUT=us XKBMODEL=pc104 XKBVARIANT=altgr-intl XKBOPTIONS=compose:menu,terminate:ctrl_alt_bksp KEYMAP=us-altgr-intl combines what in XKB terms are the two variables XKBLAYOUT=us and XKBVARIANT=altgr-intl and "sudo localectl set-keymap us-altgr-intl" will set all three variables (see "grep us-altgr-intl /usr/share/systemd/kbd-model-map") -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1209594 http://bugzilla.opensuse.org/show_bug.cgi?id=1209594#c31 Stefan Dirsch <sndirsch@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|IN_PROGRESS |RESOLVED Resolution|--- |FIXED Flags|needinfo?(noreply.section+d | |ev@gmail.com) | --- Comment #31 from Stefan Dirsch <sndirsch@suse.com> --- Ok. Just submitted my latest version now. https://build.opensuse.org/request/show/1073959 Closing. -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com