Persistent return to US keyboard in FVWM

This is related to a topic I raised over a year ago, but I think best to start anew.

The PC is dual-boot, Windows and Ubuntu 21.10, with Gnome and FVWM available at login.

The ~/.fvwm/config file contains the following code:

DestroyFunc StartFunction
AddToFunc StartFunction

  • I Module FvwmTaskBar
    #+ I Module FvwmPager *
  • I Module FvwmButtons SimpleButtons
  • I Module FvwmButtons RightPanel
  • I Exec exec setxkbmap gb

which I would expect to start FVWM with a GB keyboard. In fact, whenever I log into FVWM, the keyboard has US mapping.

I can switch to GB mapping by:

  • List item unplugging and replugging the keyboard usb, or

  • List item running Exec exec setxkbmap gb from FVWM console, or

  • List item logging out of FVWM, and logging into Gnome. Returning to FVWM reverts to US mapping

Is there something wrong with my config file?

Hi,

Fvwm isn’t respecting the MappingNotify event that keyboards often send when the layout changes. In your example, you’re expecting this change to take effect, however doing this from StartFunction means that FVWM has already started and hence the only way to get this to work is to restart FVWM.

A better approach is to have the keyboard layout set before you launch FVWM, usually in ~/.xinitrc or ~/.xsession