Home | News | Download | Packages | Forum | Wiki | Github

Change default keyboard for lxdm to local layout


#1

Hello, anytime after a fresh install of Void Linux (I used the Mate ISO), whatever the keyboard I set up during the install, the lxdm default keyboard / keymap is US and I can’t change it.

I figured I could set keyboard=1 /etc/lxdm/lxdm.conf, but that only adds a very long drop down to change the keyboard, and there seems to be no option toset the default one to something other than US.

This is a problem to type my password to log in … I have to figure out US keys on my French keyboard to be able to get in, or go through the long drop down first (and initially it wasn’t there …) … :frowning:

How can I change / configure lxdm to have the French keyboard as default on the login screen ?

Note 1: this is different from the keyboard configured once logged in Mate, Mate keyboard layout is changed through System->Preferences and has no effect on the lxdm default keyboard.
Note 2: /etc/rc.conf has the proper setup KEYMAP=azerty, but no effect on lxdm apparently.
Note 3: /etc/default/keyboard has no effect.
Note 4: I tried creating a 99-keyboard file in /etc/X11/xinit/xinitrc.d with setxkbmap -layout fr, but it has no effect either on lxdm.

I am short of any other option, so thank you in advance for any help.


#2

Keyboard layouts can be changed from lxdm greeter keyboard menu on my system.
The keyboard menu is populated from /usr/share/X11/xkb/symbols which is provided by xkeyboard-config package.
Setxkbmap from the setxkbmap package changes the keymap from the highlighted choice made in the keyboard menu.
The fact you only have US in the menu could indicate you don’t have the xkeyboard-config package installed.


#3

Hello, and thank you for the answer.

Yes xkeyboard-config is installed, and I do have a very long list of keyboards in the drop down, of which mine (fr).

The problem is to change the default keyboard from US to French, in the greeter, in order to not have to browse the long list each time I log in and type the password.

Setxkbmap, placed in /etc/X11/xinit/xinitrc.d has no effect. Indeed, I found out by tracing to /tmp that it only gets executed once I log, not before lxdm is launched.

Therefore I placed
/usr/bin/setxkbmap -layout fr -model pc105 -rules evdev -variant azerty
in the file /etc/sv/lxdm/run before the call to
exec lxdm
… but no effect either :frowning:


#4

Hello,

I’ve got this problem also and I’ve try many solutions. But I’d figure how to have french keyboard with lxdm.

This problem come from my /etc/locale.conf file. The LANG value must be fr_FR.utf8 ( I’ve got fr_FR.UTF-8 before and it not work ).

After a reboot, lxdm still show “us” in keyboard list, but it use french keymap. Just need to hide keyboards from lxdm.conf and it’s good.

I hope this work also in your case :slight_smile:


#5

Ok thanks for the suggestion.
I just tried with fr_FR.utf8 in /etc/locale.conf.
It does not work either.

I also tried fr_FR.UTF8 just in case it was case sensitive, but no more luck …

So not working in my case, or it must be something else.


#6

Found a solution by looking at the lxdm source code …
Here it is:

  • lxdm does not set the keyboard until we click something in the drop down list (if we activated it by keyboard=1 in /etc/lxdm/lxdm.conf)
  • So the keyboard is what is in the Xserver when it is started by lxdm, and before any user log in = system level setting.
  • Therefore, we need to configure the Xserver at system level …
  • Using man xorg.conf, I saw that one way is to create a /etc/X11/xorg.conf file.
  • First, find proper options to set up by issueing

setxkbmap -print -verbose 10

This tells:

Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev…
Trying to load rules file /usr/share/X11/xkb/rules/evdev…
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: fr
variant: azerty
options: terminate:ctrl_alt_bksp
Trying to build keymap using the following components:
keycodes: evdev+aliases(azerty)
types: complete
compat: complete
symbols: pc+fr(azerty)+inet(evdev)+terminate(ctrl_alt_bksp)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include “evdev+aliases(azerty)” };
xkb_types { include “complete” };
xkb_compat { include “complete” };
xkb_symbols { include “pc+fr(azerty)+inet(evdev)+terminate(ctrl_alt_bksp)” };
xkb_geometry { include “pc(pc105)” };
};

  • Then create a /etc/X11/xorg.conf file (see man xorg.conf for details):

Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option “XkbLayout” "fr"
Option “XkbModel” "pc105"
Option “XkbVariant” "azerty"
Option “XkbRules” "evdev"
Option “XkbOptions” "terminate:ctrl_alt_bksp"
EndSection

Reboot … now keys are typed in French layout :smile:
… although lxdm continues to show “US” as current keyboard !! :smiling_imp:


Tentative explanation:

Looking at the LXDM code, this is in greeter.c, in load_keyboards(), xkb_get_current() and xkb_name_norm()

The string for the current keyboard is got from xkb_desc->names->symbols
and should match one of the entries in /usr/share/X11/xkb/symbols.

Problem is that the code in xkb_name_norm() doesn’t handle variants and so does not recognize fr(azerty).

It would only look for fr as it is in /usr/share/X11/xkb/symbols and does not remove the piece between () …

Maybe a request should be open on lxdm …? I may try on their forum.

Note: I tried to use only Option “XkbLayout” “fr” without specifying a variant, model … etc …, but no luck.

I also tried forcing with

Option “XkbSymbols” “pc+fr(azerty)+inet(evdev)+terminate(ctrl_alt_bksp)”

however this has no effect.
And as a matter of fact this setting has disappeared of the X11 doc as of 7.6, which is the one on void linux as I get it (it was in 7.5 doc …).


Hope this will help others. Erwin :pray:


[ Solved ] Void musl, some beginner questions?
[ Solved ] Void musl, some beginner questions?
#7

Coming back on this … could the Void installer be modified to include creating the proper /etc/X11/xorg.conf file as above, on ISO’s containing lxdm like the Mate ISO ?

Contents would depend on the keyboard chosen at install time, for example:

Option “XkbLayout” "fr"
Option “XkbModel” "pc105"
Option “XkbVariant” "azerty"
Option “XkbRules” “evdev”

This would avoid problems for non US people installing Void and not able to type in their password … :sweat:

Thanks, Erwin.


(Jürgen Buchmüller) #8

To avoid problems with the keyboard when running void-installer, you could run it from a console instead of from Xorg. Press keys Ctrl+Alt+F2 together, login as root with password voidlinux and run void-installer.

After you selected your keyboard layout in the first menu entry, the loadkeys <layout> command is run and further inputs will use the selected layout, including hidden inputs of passwords.

Making void-installer also setup the keyboard for Xorg is an open issue, because it needs some kind of translation of the loadkeys <layout1> parameter layout1 to a corresponding or best matching setxkbmap <layout2> parameter layout2.