help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keyboard layout options not working


From: Hilton Chain
Subject: Re: Keyboard layout options not working
Date: Thu, 07 Dec 2023 19:50:24 +0800

Hi Efraim and Lars,
On Thu, 07 Dec 2023 18:28:53 +0800,
Efraim Flashner wrote:
>
> On Thu, Dec 07, 2023 at 10:48:11AM +0100, Lars Rustand wrote:
> > Hello, I'm trying to set the keyboard-layout options in my system config. I
> > have set the following:
> >
> > -8<---------------cut here---------------start------------->8---
> > (keyboard-layout (keyboard-layout "us,no" #:options '("grp:switch")))
> > -8<---------------cut here---------------end--------------->8---


In (gnu system keyboard), keyboard-layout is defined as:
--8<---------------cut here---------------start------------->8---
(keyboard-layout name (variant) (#:model) (#:options))
--8<---------------cut here---------------end--------------->8---

So the following should be used instead:
--8<---------------cut here---------------start------------->8---
(keyboard-layout "us" "no" #:options '("grp:switch"))
--8<---------------cut here---------------end--------------->8---


For TTY usage, the <keyboard-layout> record is used to create a console keymap
via ckbcomp, which has a different syntax from setxkbmap and requires a space
between layout and variant.


> > The above seems to have no effect. However, the same option works fine
> > when used with setxkbmap like this:
> >
> > -8<---------------cut here---------------start------------->8---
> > setxkbmap us,no -option 'grp:switch'
> > -8<---------------cut here---------------end--------------->8---
> >
> > It also works fine if set in `/etc/X11/xorg.conf.d/00-keyboard.conf`
> > like this:
> >
> > -8<---------------cut here---------------start------------->8---
> > Section "InputClass"
> >         Identifier "system-keyboard"
> >         MatchIsKeyboard "on"
> >         Option "XkbLayout" "us,no"
> >         Option "XkbOptions" "grp:switch"
> > EndSection
> > -8<---------------cut here---------------end--------------->8---
>
> I wouldn't mind getting the answer to this too.
>
> I have my keyboard config set in my os-config and also in my
> sway-config.  IIRC the keyboard-layout works really well in a TTY but
> not always as well on the desktop.


And for X, xorg-configuration accepts a <keyboard-layout> record and sets option
XkbLayout to the name field of that record and XkbVariant to variant (only when
it's present).  Since XkbLayout recognizes the comma syntax and variant is not
set, the result is valid.

So support for <keyboard-layout> is really environment-specific... But for sway
there's a procedure in rde[1] to create an input configuration as an alist, I
think it can be adapted to create a string as well (I personally use a
mixed-text-file for my sway config[2]).


Thanks
---
[1]: https://git.sr.ht/~abcdw/rde/tree/master/item/src/rde/features/wm.scm#L94
[2]: https://github.com/rakino/Testament/blob/trunk/dorphine-home.scm#L129



reply via email to

[Prev in Thread] Current Thread [Next in Thread]