summaryrefslogtreecommitdiff
path: root/modules/alt-arrow-vt.nix
blob: d0dbb90174f85c092831ea50df9c7edac7f0aec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  pkgs,
  ...
}:
{
  # Disable Alt+Left/Right virtual terminal switching
  console.keyMap = "us";

  # Create systemd service to disable only Alt+Arrow VT switching
  systemd.services.disable-alt-arrow-vt = {
    description = "Disable Alt+Arrow VT switching";
    wantedBy = [ "multi-user.target" ];
    after = [ "systemd-vconsole-setup.service" ];
    script = ''
      # Define string sequences for Alt+Arrow that generate proper terminal escape sequences
      cat << 'EOF' | ${pkgs.kbd}/bin/loadkeys
      string F200 = "\033[1;3D"
      string F201 = "\033[1;3C"
      alt keycode 105 = F200
      alt keycode 106 = F201
      EOF
    '';
    serviceConfig = {
      Type = "oneshot";
      RemainAfterExit = true;
    };
  };

}