Default keyboard layout prior to login

Running Linux on a Macbook. Read through the wiki and was wondering if there’s a way to set the default keyboard layout to Colemak-dh so that it’s active prior to logging into Hyprland.

Currently, between LUKS and Hyprland starting, I’m in QWERTY. Once Hyprland opens, I’m in Colemak-dh. Here’s my config:

  services = {
    xserver = {
      xkb.layout = "us,us";
      xkb.variant = "colemak_dh,";
      xkb.options = "grp:shifts_toggle";
    };
  };

I don’t know the answer, but do you mean for LUKS or for your display manager?

For LUKS, I found a thread that might be relevant for this.

Specifically, see the last post for something that apparently works.

For your display manager, it might depend on what display manager you’re using, and whether it is being used in X11 mode or Wayland mode.

1 Like

That worked - thank you! I had to reduce the layouts to just Colemak-DH in configuration.nix:

  # Apply system keymap to decrypt/login on boot
  console = {
    earlySetup = true;
    useXkbConfig = true;
  };

  services = {
    xserver = {
      xkb.layout = "us";
      xkb.variant = "colemak_dh";
    };
  };

Then in my hyprland config I can have the secondary qwerty layout that I can easily switch back to by hitting both shift keys at the same time, if needed:

      input = {
        kb_layout = "us,us";
        kb_variant = "colemak_dh,";
        kb_options = "grp:shifts_toggle";
      };

This is fantastic. Thanks again, @jchw.

1 Like