unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Keyboard layout options not working
@ 2023-12-07  9:48 Lars Rustand
  2023-12-07 10:28 ` Efraim Flashner
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Rustand @ 2023-12-07  9:48 UTC (permalink / raw)
  To: help-guix

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---

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---


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Keyboard layout options not working
  2023-12-07  9:48 Keyboard layout options not working Lars Rustand
@ 2023-12-07 10:28 ` Efraim Flashner
  2023-12-07 11:50   ` Hilton Chain
  0 siblings, 1 reply; 7+ messages in thread
From: Efraim Flashner @ 2023-12-07 10:28 UTC (permalink / raw)
  To: Lars Rustand; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]

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---
> 
> 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.

-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Keyboard layout options not working
  2023-12-07 10:28 ` Efraim Flashner
@ 2023-12-07 11:50   ` Hilton Chain
  2023-12-07 12:28     ` Lars Rustand
  0 siblings, 1 reply; 7+ messages in thread
From: Hilton Chain @ 2023-12-07 11:50 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: Lars Rustand, help-guix

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Keyboard layout options not working
  2023-12-07 11:50   ` Hilton Chain
@ 2023-12-07 12:28     ` Lars Rustand
  2023-12-07 12:53       ` Lars Rustand
  2023-12-07 13:46       ` Hilton Chain
  0 siblings, 2 replies; 7+ messages in thread
From: Lars Rustand @ 2023-12-07 12:28 UTC (permalink / raw)
  To: help-guix; +Cc: Efraim Flashner, Hilton Chain


Hilton Chain <hako@ultrarare.space> writes:
> In (gnu system keyboard), keyboard-layout is defined as:
>
> (keyboard-layout name (variant) (#:model) (#:options))
>
>
> So the following should be used instead:
>
> (keyboard-layout "us" "no" #:options '("grp:switch"))

I tried the above, but I get this following errror:

-8<---------------cut here---------------start------------->8---
error: (keyboard-layout "us" "no" #:options (quote ("grp:switch"))): invalid field specifier
-8<---------------cut here---------------end--------------->8---

> 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.

Well, this comma syntax is precisely what I am trying to use. Note that
the "us,no" in my config refers to the list of US layout and NO layout,
not a NO variant of the US layout (I don't think there is such a
variant). The expected result of my keyboard-layout config is that I
have US layout by default, and when I hold down the right alt key I get
the NO layout.

A similar configuration is shown in the examples under the Keyboard
Layout section in the Guix manual. 

-8<---------------cut here---------------start------------->8---
;; Arabic layout with "Alt-Shift" to switch to US layout.
(keyboard-layout "ar,us" #:options '("grp:alt_shift_toggle"))
-8<---------------cut here---------------end--------------->8---


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Keyboard layout options not working
  2023-12-07 12:28     ` Lars Rustand
@ 2023-12-07 12:53       ` Lars Rustand
  2023-12-07 13:46       ` Hilton Chain
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Rustand @ 2023-12-07 12:53 UTC (permalink / raw)
  To: help-guix; +Cc: Efraim Flashner, Hilton Chain


Lars Rustand <rustand.lars@gmail.com> writes:

>> (keyboard-layout "us" "no" #:options '("grp:switch"))
>
> I tried the above, but I get this following errror:
>
> error: (keyboard-layout "us" "no" #:options (quote ("grp:switch"))): invalid field specifier

I see I have made an error in the above, I pasted that directly into my
operating system definition instead of wrapping it in an additional
`keyboard-layout` field. When wrapping it it runs successfully, but I
still get the same result as before, i.e. it ignores my options and
additional layout.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Keyboard layout options not working
  2023-12-07 12:28     ` Lars Rustand
  2023-12-07 12:53       ` Lars Rustand
@ 2023-12-07 13:46       ` Hilton Chain
  2023-12-07 20:17         ` Lars Rustand
  1 sibling, 1 reply; 7+ messages in thread
From: Hilton Chain @ 2023-12-07 13:46 UTC (permalink / raw)
  To: Lars Rustand; +Cc: help-guix, Efraim Flashner

On Thu, 07 Dec 2023 20:28:02 +0800,
Lars Rustand wrote:
>
>
> Hilton Chain <hako@ultrarare.space> writes:
> > In (gnu system keyboard), keyboard-layout is defined as:
> >
> > (keyboard-layout name (variant) (#:model) (#:options))
> >
> >
> > So the following should be used instead:
> >
> > (keyboard-layout "us" "no" #:options '("grp:switch"))
>
> I tried the above, but I get this following errror:
>
> -8<---------------cut here---------------start------------->8---
> error: (keyboard-layout "us" "no" #:options (quote ("grp:switch"))): invalid field specifier
> -8<---------------cut here---------------end--------------->8---
>
> > 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.
>
> Well, this comma syntax is precisely what I am trying to use. Note
> that the "us,no" in my config refers to the list of US layout and NO
> layout, not a NO variant of the US layout (I don't think there is
> such a variant). The expected result of my keyboard-layout config is
> that I have US layout by default, and when I hold down the right alt
> key I get the NO layout.
>
> A similar configuration is shown in the examples under the Keyboard
> Layout section in the Guix manual.
>
> -8<---------------cut here---------------start------------->8---
> ;; Arabic layout with "Alt-Shift" to switch to US layout.
> (keyboard-layout "ar,us" #:options '("grp:alt_shift_toggle"))
> -8<---------------cut here---------------end--------------->8---


I didn't check setxkbmap when sending the mail, actually its syntax is
the same of ckbcomp.  So you don't have to change the procedure call,
sorry for my misinterpretation.

The keyboard-layout field of operating-system is solely for console
use (used by GRUB, and later loaded via loadkeys when booting).  So
you'll have to pass a <keyboard-layout> record to the keyboard-layout
field of your xorg-configuration.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Keyboard layout options not working
  2023-12-07 13:46       ` Hilton Chain
@ 2023-12-07 20:17         ` Lars Rustand
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Rustand @ 2023-12-07 20:17 UTC (permalink / raw)
  To: help-guix; +Cc: Efraim Flashner, Hilton Chain


Hilton Chain <hako@ultrarare.space> writes:
> The keyboard-layout field of operating-system is solely for console
> use (used by GRUB, and later loaded via loadkeys when booting).  So
> you'll have to pass a <keyboard-layout> record to the keyboard-layout
> field of your xorg-configuration.

Thanks, this worked! I was not aware that the keyboard-layout in the
operating-system definition was not used for xorg.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-07 20:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-07  9:48 Keyboard layout options not working Lars Rustand
2023-12-07 10:28 ` Efraim Flashner
2023-12-07 11:50   ` Hilton Chain
2023-12-07 12:28     ` Lars Rustand
2023-12-07 12:53       ` Lars Rustand
2023-12-07 13:46       ` Hilton Chain
2023-12-07 20:17         ` Lars Rustand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).