dotfiles

My PC Dotfiles & Website

modules/desktop/niri/_settings/keybinds.nix (3943B)


  1## Compositor Binds
  2_: {config, ...}: {
  3  programs.niri.settings = {
  4    input.power-key-handling.enable = false;
  5    binds = with config.lib.niri.actions; let
  6      sh = spawn "sh" "-c";
  7    in
  8      {
  9        # Compositor
 10        "Alt+F4".action = close-window;
 11        "Super+Q".action = close-window;
 12        "Super+C".action = center-window;
 13        "Super+E".action = maximize-window-to-edges;
 14        "Super+Shift+E".action = fullscreen-window;
 15        "Super+bracketright".action = set-column-width "+10%";
 16        "Super+bracketleft".action = switch-preset-column-width;
 17        "Super+equal".action = maximize-column;
 18        "Super+minus".action = switch-preset-window-height;
 19        "Super+semicolon".action = toggle-window-floating;
 20        "Super+apostrophe".action = switch-focus-between-floating-and-tiling;
 21        "Super+Shift+Tab".action = toggle-column-tabbed-display;
 22
 23        "Super+Tab".action = toggle-overview;
 24        "Super+Right".action = focus-column-or-monitor-right;
 25        "Super+Left".action = focus-column-or-monitor-left;
 26        "Super+Up".action = focus-window-or-workspace-up;
 27        "Super+Down".action = focus-window-or-workspace-down;
 28
 29        "Super+Shift+Right".action = consume-or-expel-window-right;
 30        "Super+Shift+Left".action = consume-or-expel-window-left;
 31        "Super+Shift+Up".action = move-window-up-or-to-workspace-up;
 32        "Super+Shift+Down".action = move-window-down-or-to-workspace-down;
 33        "Super+Shift+Return".action = move-window-to-monitor-next;
 34
 35        # Screenshots
 36        "Print".action = sh "noctalia msg screenshot-region";
 37        "Shift+Print".action = sh "noctalia msg screenshot-fullscreen pick";
 38        "Ctrl+Print".action.screenshot-window = [];
 39
 40        # Controls
 41        "Super+L" = {
 42          action = sh "noctalia msg session lock";
 43          hotkey-overlay.title = "Lock Screen";
 44        };
 45
 46        "XF86AudioPlay".action = sh "noctalia msg media toggle";
 47        "XF86AudioPrev".action = sh "noctalia msg media previous";
 48        "XF86AudioNext".action = sh "noctalia msg media next";
 49        "XF86AudioMute".action = sh "noctalia msg volume-mute";
 50        "XF86AudioRaiseVolume".action = sh "noctalia msg volume-up";
 51        "XF86AudioLowerVolume".action = sh "noctalia msg volume-down";
 52        "XF86MonBrightnessUp".action = sh "noctalia msg brightness-up";
 53        "XF86MonBrightnessDown".action = sh "noctalia msg brightness-down";
 54        "XF86KbdBrightnessUp".action = sh "noctalia msg keyboard-backlight-up";
 55        "XF86KbdBrightnessDown".action = sh "noctalia msg keyboard-backlight-down";
 56
 57        # Mouse
 58        "Super+Shift+MouseRight".action = switch-preset-window-width;
 59        "Super+WheelScrollUp" = {
 60          action = focus-column-left;
 61          cooldown-ms = 150;
 62        };
 63        "Super+WheelScrollDown" = {
 64          action = focus-column-right;
 65          cooldown-ms = 150;
 66        };
 67        "Super+Shift+WheelScrollUp" = {
 68          action = focus-workspace-up;
 69          cooldown-ms = 150;
 70        };
 71        "Super+Shift+WheelScrollDown" = {
 72          action = focus-workspace-down;
 73          cooldown-ms = 150;
 74        };
 75
 76        # Keyhelp
 77        "Super+slash" = {
 78          action = spawn "noctalia" "msg" "plugin" "maydayv7/keyhelp:controller" "all" "toggle" "niri";
 79          repeat = false;
 80          hotkey-overlay.title = "Keyhelp";
 81        };
 82      }
 83      //
 84      # Workspaces
 85      builtins.listToAttrs (
 86        builtins.concatLists (
 87          builtins.genList (
 88            n: let
 89              num = n + 1;
 90              snum = toString (n + 1);
 91            in [
 92              {
 93                name = "Super+${snum}";
 94                value.action = focus-workspace num;
 95              }
 96              {
 97                name = "Super+Shift+${snum}";
 98                value.action.move-window-to-workspace = num;
 99              }
100            ]
101          )
102          9
103        )
104      );
105  };
106}