Jump to content

Xremap: Difference between revisions

From Official NixOS Wiki
Deckori (talk | contribs)
m Remapping the Copilot key: Corrected code that doesn't work anymore and added more instructions
DHCP (talk | contribs)
m Remapping the Copilot key: fix indentation
 
Line 24: Line 24:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
services.xremap = {
services.xremap = {
      enable = true;
  enable = true;
      package = pkgs.xremap; # Use the official package to skip building xremap from source
  package = pkgs.xremap; # Use the official package to skip building xremap from source
      userName = "username"; # The username of your user
  userName = "username"; # The username of your user
      yamlConfig = ''
  yamlConfig = ''
        experimental_map:
    experimental_map:
          - chords:
      - chords:
              - keys: [Super_L, Shift_L, F23]
          - keys: [Super_L, Shift_L, F23]
                actions: Ctrl_R
            actions: Ctrl_R
                timeout: 30
            timeout: 30
      '';
  '';
 
};
};
</nowiki>}}
</nowiki>}}

Latest revision as of 19:58, 19 July 2026

Install the flake module

Refer to Xremap's documentation on their GitHub repository.

Remapping the Copilot key

An increasing number of new laptops come with a Copilot key that you might want to remap. Follow these steps to do so:

Start a shell with keyd available nix-shell -p keyd to monitor what the Copilot key does and see your keyboard id. From that shell, run sudo keyd monitor and press the Copilot key.

AT Translated Set 2 keyboard	0001:0001:09b4e68d	leftmeta down
AT Translated Set 2 keyboard	0001:0001:09b4e68d	leftshift down
AT Translated Set 2 keyboard	0001:0001:09b4e68d	f23 down
AT Translated Set 2 keyboard	0001:0001:09b4e68d	f23 up
AT Translated Set 2 keyboard	0001:0001:09b4e68d	leftshift up
AT Translated Set 2 keyboard	0001:0001:09b4e68d	leftmeta up

Then translate the names of keys to the ones used by Xremap.

You may then edit your configuration accordingly:

❄︎ /etc/nixos/configuration.nix
services.xremap = {
  enable = true;
  package = pkgs.xremap; # Use the official package to skip building xremap from source
  userName = "username"; # The username of your user
  yamlConfig = ''
    experimental_map:
      - chords:
          - keys: [Super_L, Shift_L, F23]
            actions: Ctrl_R
            timeout: 30
  '';
};

This configuration was made by referring to a GitHub discussion.

Note: At the time of writing, the above works as of Xremap version 0.14.19 in the nixpkgs-unstable channel. The flake version provided version 0.15.1. This version mismatch might cause errors. So adjust your configuration accordingly.