summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/niri/default.nix
blob: 6a8d10a09221c984385d1ab12abc30555fd1b00d (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{ config, pkgs, lib, ... }:
let
  niri = config.programs.niri.package;
  terminal = lib.getExe config.programs.kitty.package;
  lightctl = lib.getExe' config.services.avizo.package "lightctl";
  volumectl = lib.getExe' config.services.avizo.package "volumectl";
  dunstctl = lib.getExe' config.services.dunst.package "dunstctl";
in {
  imports = [
    ./waybar.nix
  ];

  config = {
    systemd.user.services.xwayland-satellite = {
      Unit = {
        BindsTo = [ "graphical-session.target" ];
        PartOf = [ "graphical-session.target" ];
        After = [ "graphical-session.target" ];
        Requisite = [ "graphical-session.target" ];
      };
      Service = {
        Type = "notify";
        NotifyAccess = "all";
        ExecStart = lib.getExe pkgs.xwayland-satellite-unstable;
        StandardOutput = "journal";
      };
      Install = {
        WantedBy = [ "graphical-session.target" ];
      };
    };

    programs.niri.settings = {
      prefer-no-csd = true;
      screenshot-path = "${config.home.homeDirectory}/screenshots";

      input = {
        keyboard.xkb = {
          layout = "us,";
          variant = "dvp,";
          options = "compose:caps,grp:win_space_toggle";
        };
      };

      environment = {
        NIXOS_OZONE_WL = "1";
        QT_QPA_PLATFORM = "wayland";
        GDK_BACKEND = "wayland";
        SDL_VIDEODRIVER = "wayland";
      };

      cursor.hide-when-typing = true;

      binds = with config.lib.niri.actions; {
        "Mod+Return".action = spawn terminal;
        "Mod+Q".action = close-window;
        "Mod+D".action = spawn (lib.getExe config.programs.fuzzel.package);
        "Mod+Shift+D".action = spawn (lib.getExe config.programs.fuzzel.package) "--list-executables-in-path";

        "Mod+H".action = focus-column-left;
        "Mod+T".action = focus-window-down;
        "Mod+N".action = focus-window-up;
        "Mod+S".action = focus-column-right;

        "Mod+Shift+H".action = move-column-left;
        "Mod+Shift+T".action = move-window-down;
        "Mod+Shift+N".action = move-window-up;
        "Mod+Shift+S".action = move-column-right;

        "Mod+Control+H".action = focus-monitor-left;
        "Mod+Control+T".action = focus-monitor-down;
        "Mod+Control+N".action = focus-monitor-up;
        "Mod+Control+S".action = focus-monitor-right;

        "Mod+Shift+Control+H".action = move-workspace-to-monitor-left;
        "Mod+Shift+Control+T".action = move-workspace-to-monitor-down;
        "Mod+Shift+Control+N".action = move-workspace-to-monitor-up;
        "Mod+Shift+Control+S".action = move-workspace-to-monitor-right;

        "Mod+G".action = focus-workspace-down;
        "Mod+C".action = focus-workspace-up;

        "Mod+Control+G".action = move-column-to-workspace-down;
        "Mod+Control+C".action = move-column-to-workspace-up;

        "Mod+Shift+G".action = move-workspace-down;
        "Mod+Shift+C".action = move-workspace-up;

        "Mod+M".action = consume-window-into-column;
        "Mod+W".action = expel-window-from-column;

        "Mod+F".action = maximize-column;
        "Mod+Shift+F".action = fullscreen-window;

        "Mod+Space".action = switch-focus-between-floating-and-tiling;
        "Mod+Shift+Space".action = toggle-window-floating;

        "Mod+Left".action = set-column-width "-10%";
        "Mod+Down".action = set-window-height "-10%";
        "Mod+Up".action = set-window-height "+10%";
        "Mod+Right".action = set-column-width "+10%";

        "Mod+Shift+Z" = {
          action = spawn (lib.getExe niri) "msg" "action" "power-off-monitors";
          allow-when-locked = true;
        };

        "XF86MonBrightnessUp" = {
          action = spawn lightctl "-d" "-e4" "-n1" "up";
          allow-when-locked = true;
        };
        "XF86MonBrightnessDown" = {
          action = spawn lightctl "-d" "-e4" "-n1" "down";
          allow-when-locked = true;
        };
        "XF86AudioRaiseVolume" = {
          action = spawn volumectl "-d" "-u" "up";
          allow-when-locked = true;
        };
        "XF86AudioLowerVolume" = {
          action = spawn volumectl "-d" "-u" "down";
          allow-when-locked = true;
        };
        "XF86AudioMute" = {
          action = spawn volumectl "-d" "toggle-mute";
          allow-when-locked = true;
        };
        "XF86AudioMicMute" = {
          action = spawn volumectl "-d" "-m" "toggle-mute";
          allow-when-locked = true;
        };

        "Mod+Semicolon".action = spawn dunstctl "close";
        "Mod+Shift+Semicolon".action = spawn dunstctl "close-all";
        "Mod+Period".action = spawn dunstctl "context";
        "Mod+Comma".action = spawn dunstctl "history-pop";
      };
    };
  };
}