Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]How to change keyboard layout in LightDM
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
jody
l33t
l33t


Joined: 16 Oct 2007
Posts: 668
Location: Switzerland

PostPosted: Mon Jun 18, 2018 10:33 am    Post subject: [SOLVED]How to change keyboard layout in LightDM Reply with quote

I have installed xfce with lightDM.

My problem is that i have a swiss keyboard, but the greeter of lightDM is set to "en_US.utf8" and there are no alternatives to choose from.

Following advice on posts to similar questions i have added an I /etc/X11/xorg.conf.d/10-keyboard.conf:
Code:
Section "InputClass"
    Identifier "keyboard-all"
    Driver "evdev"
    Option "XkbLayout" "ch(de_nodeadkeys)"
    MatchIsKeyboard "on"
EndSection


And to /etc/lightdm/lightdm.conf i added the line:
Code:
 display-setup-script=/usr/bin/setxkbmap ch


But none of this did help.

Note that once logged in, i do have the correct keyboard layout.
The correct keyboard layout is also set when i go to a console with Alt-Ctrl-F1

These are the contents of my /etc/locale.gen:
Code:
en_US ISO-8859-1
en_US.UTF-8 UTF-8
de_CH ISO-8859-1


How can i change the keyboard layout to the correct setting?


Last edited by jody on Tue Jun 19, 2018 6:28 am; edited 1 time in total
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30913
Location: here

PostPosted: Mon Jun 18, 2018 11:02 am    Post subject: Re: How to change keyboard layout in LightDM Reply with quote

jody wrote:
I have installed xfce with lightDM.

My problem is that i have a swiss keyboard, but the greeter of lightDM is set to "en_US.utf8" and there are no alternatives to choose from.

Following advice on posts to similar questions i have added an I /etc/X11/xorg.conf.d/10-keyboard.conf:
Code:
Section "InputClass"
    Identifier "keyboard-all"
    Driver "evdev"
    Option "XkbLayout" "ch(de_nodeadkeys)"
    MatchIsKeyboard "on"
EndSection

You tried
Code:
Section "InputClass"
    Identifier "keyboard-all"
    Driver "evdev"
    Option "XkbLayout" "ch"
    Option "XkbVariant" "de_nodeadkeys"
    MatchIsKeyboard "on"
EndSection

_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Mon Jun 18, 2018 11:52 am    Post subject: Reply with quote

'de_nodeadkeys' is a keyboard variant, not a layout. See the contents of the file /usr/share/X11/xkb/rules/base.lst for the permissible keyboard models, layouts, variants and options under the headings:

Code:
$ cat /usr/share/X11/xkb/rules/base.lst | grep "^\!"
! model
! layout
! variant
! option

Code:
$ awk '/\! layout/,/\! variant/' /usr/share/X11/xkb/rules/base.lst | sed -e '1d;$d' | grep Swi
  ch              German (Switzerland)
$ awk '/\! variant/,/\! option/' /usr/share/X11/xkb/rules/base.lst | sed -e '1d;$d' | grep Swi
  legacy          ch: German (Switzerland, legacy)
  de_nodeadkeys   ch: German (Switzerland, no dead keys)
  de_sundeadkeys  ch: German (Switzerland, with Sun dead keys)
  fr              ch: French (Switzerland)
  fr_nodeadkeys   ch: French (Switzerland, no dead keys)
  fr_sundeadkeys  ch: French (Switzerland, with Sun dead keys)
  fr_mac          ch: French (Switzerland, Macintosh)
  de_mac          ch: German (Switzerland, Macintosh)


So, as fedeliallalinea pointed out, you're going to need:

Code:
Option "XkbLayout" "ch"
Option "XkbVariant" "de_nodeadkeys"

_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
jody
l33t
l33t


Joined: 16 Oct 2007
Posts: 668
Location: Switzerland

PostPosted: Mon Jun 18, 2018 2:06 pm    Post subject: Reply with quote

I have now changed my /etc/X11/xorg.conf.d/10-keyboard.conf according to fideliallaline's suggestions:
Code:
Section "InputClass"
    Identifier "keyboard-all"
    Driver "evdev"
    Option "XkbLayout"  "ch"
    Option "XkbVariant" "de_nodeadkeys"
    MatchIsKeyboard "on"
EndSection


But lightDM still offers only "en_US.utf8", even after rebooting.
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30913
Location: here

PostPosted: Mon Jun 18, 2018 2:14 pm    Post subject: Reply with quote

jody wrote:
But lightDM still offers only "en_US.utf8", even after rebooting.

I don't use lightdm but en_US is encoding or keyboard layout?
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Mon Jun 18, 2018 2:41 pm    Post subject: Reply with quote

Which Desktop Environment and init system are you using?

I do use LightDM (OpenRC installation), and have four keyboard layouts configured (I use various USB keyboards in different locations), with the default being en_GB (the first in the list of keyboard layouts in my X11 configuration file). I notice that the Identifier in the X11 configuration file in my installation is "keyboard", not "keyboard-all", and the X11 configuration file does not explicitly mention the evdev driver:

Code:
 $ ls /etc/X11/xorg.conf.d/
10-evdev.conf  20opengl.conf  30-keyboard.conf  50-synaptics.conf

Code:
$ cat /etc/X11/xorg.conf.d/30-keyboard.conf
Section "InputClass"
    Identifier "keyboard"
    # See /usr/share/X11/xkb/rules/base.lst for Options.
    MatchIsKeyboard "yes"
    Option "XkbLayout" "gb,us,br,es"
    Option "XkbModel" "pc104"
#    Option "XkbVariant" ""
    Option "XkbOptions" "grp:alt_shift_toggle"
EndSection


Try the following instead of what you are using now:

Code:
$ cat /etc/X11/xorg.conf.d/30-keyboard.conf
Section "InputClass"
    Identifier "keyboard"
    # See /usr/share/X11/xkb/rules/base.lst for Options.
    MatchIsKeyboard "yes"
    Option "XkbLayout" "ch"
    Option "XkbVariant" "de_nodeadkeys"
EndSection

_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog


Last edited by Fitzcarraldo on Mon Jun 18, 2018 2:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
jody
l33t
l33t


Joined: 16 Oct 2007
Posts: 668
Location: Switzerland

PostPosted: Mon Jun 18, 2018 2:42 pm    Post subject: Reply with quote

Apparently "en_US.utf8" is a locale.

When i run the command 'locale' on my computer, i get:
Code:
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=


So i tried to change my locale:
Code:
$ sudo eselect locale list
Available targets for the LANG variable:
  [1]   C
  [2]   de_CH
  [3]   de_CH.iso88591 *
  [4]   en_US
  [5]   en_US.iso88591
  [6]   en_US.utf8
  [7]   POSIX
  [ ]   (free form)
 $ . /etc/profile
 $ locale
LANG=de_CH.iso88591
LC_CTYPE="de_CH.iso88591"
LC_NUMERIC="de_CH.iso88591"
LC_TIME="de_CH.iso88591"
LC_COLLATE="de_CH.iso88591"
LC_MONETARY="de_CH.iso88591"
LC_MESSAGES="de_CH.iso88591"
LC_PAPER="de_CH.iso88591"
LC_NAME="de_CH.iso88591"
LC_ADDRESS="de_CH.iso88591"
LC_TELEPHONE="de_CH.iso88591"
LC_MEASUREMENT="de_CH.iso88591"
LC_IDENTIFICATION="de_CH.iso88591"
LC_ALL=
which looked good, but when i logged out, lightDM was still set to "en_US.utf8", also after restarting my computer.
When i logged in again, the "locale" command showed all entries were reset to "en_US.utf8".
So maybe this is not the solution to my problem...
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Mon Jun 18, 2018 2:48 pm    Post subject: Reply with quote

See my previous post. Also, you need to do the following after you set a new locale:

Code:
# env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...

_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30913
Location: here

PostPosted: Mon Jun 18, 2018 2:50 pm    Post subject: Reply with quote

It's better to add a utf8 locale (in your case de_CH.UTF-8).

For wrong locale in lightdm see also https://wiki.archlinux.org/index.php/LightDM#Wrong_locale_displayed
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Mon Jun 18, 2018 2:56 pm    Post subject: Reply with quote

Also check in /usr/share/i18n/SUPPORTED what locales you can specify in /etc/locale.gen:

Code:
$ grep CH /usr/share/i18n/SUPPORTED
de_CH.UTF-8 UTF-8
de_CH ISO-8859-1
fr_CH.UTF-8 UTF-8
fr_CH ISO-8859-1
it_CH.UTF-8 UTF-8
it_CH ISO-8859-1
wae_CH UTF-8

_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
jody
l33t
l33t


Joined: 16 Oct 2007
Posts: 668
Location: Switzerland

PostPosted: Tue Jun 19, 2018 6:28 am    Post subject: Reply with quote

I added the locale 'de_CH.utf8' to my locales, and then did
Code:
env-update && source /etc/profile
.
I left the line
Code:
display-setup-script=/usr/bin/setxkbmap ch
in '/etc/lightdm/lightdm.conf'.

Next time i logged in, lightDM let me choose between 'en_US.utf8' and 'de_CH.utf8', so i'm happy now with this.
Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum