Key remapping with home-manager for GNOME wayland

For a while I am using an ANSI-US keyboard, but being german I wanted to write Umlauts easily, so I switched to the “de+us” layout. So far, so good, but now I am still missing the ellipsis which can be entered with ALT+. on a german keyboard. After half a day of research I finally found some recipe on how to modify the keymap for GNOME on wayland.

  dconf.settings."org/gnome/desktop/input-sources".xkb-options = [ "mod:ellipsis" ];
  xdg.configFile."xkb/symbols/mod".text = ''
    xkb_symbols "ellipsis" {
      key <AB09> { [ period, greater, ellipsis, division ] };
    };
  '';
  xdg.configFile."xkb/rules/evdev".text = ''
    ! option = symbols
      mod:ellipsis    = +mod(ellipsis)
    ! include %S/evdev
  '';

With this you can modify your xkb config to your liking.

I did a similar thing, mixing NixOS and home-manager options (any instances of hm in my config corresponds to home-manager). I’m sure you could recreate this without home-manager at all, using the programs.dconf module. Interestingly, some apps don’t seem to obey this - not sure why.

1 Like