zaphyra's git: nixfiles

zaphyra's nixfiles

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 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
163 
164 
165 
166 
167 
168 
169 
170 
171 
172 
173 
174 
175 
176 
177 
178 
179 
180 
181 
182 
183 
184 
{
  config,
  lib,
  pkgs,
  ...
}:

{

  config = lib.mkIf config.zaphyra.programs.niri.enable {
    programs.niri.settings = {
      binds =
        (lib.mergeAttrsList (
          lib.map
            (num: {
              "Mod+${toString num}" = lib.mkDefault { action.focus-workspace = num; };
              "Mod+Shift+${toString num}" = lib.mkDefault { action.move-column-to-workspace = num; };
            })
            [
              1
              2
              3
              4
              5
              6
              7
              8
              9
            ]
        ))
        // (lib.mapAttrs
          (
            _: attrs:
            (lib.mkDefault (
              attrs
              // {
                action =
                  if (lib.isList attrs.action) then
                    {
                      "spawn" = attrs.action;
                    }
                  else if (lib.isAttrs attrs.action) then
                    attrs.action
                  else
                    {
                      "${attrs.action}" = [ ];
                    };
              }
            ))
          )
          {
            "Mod+1".action.focus-workspace = "browser";
            "Mod+Shift+1".action.move-column-to-workspace = "browser";
            "Mod+2".action.focus-workspace = "mail";
            "Mod+Shift+2".action.move-column-to-workspace = "mail";
            "Mod+3".action.focus-workspace = "terminal";
            "Mod+Shift+3".action.move-column-to-workspace = "terminal";
            "Mod+4".action.focus-workspace = "chat";
            "Mod+Shift+4".action.move-column-to-workspace = "chat";

            "Mod+Shift+E".action = "quit";
            "Mod+Z".action = "power-off-monitors";
            # "Mod+Z".action = spawn (lib.getExe' pkgs.systemd "systemctl") "suspend";

            "Mod+Space".action = [ (lib.getExe pkgs.fuzzel) ];
            "Mod+Return".action = [
              (lib.getExe pkgs.unstable.app2unit)
              "-T"
            ];
            "Mod+L".action = [
              (lib.getExe' pkgs.systemd "loginctl")
              "lock-session"
            ];

            "Mod+W" = {
              action = "close-window";
              repeat = false;
            };

            "XF86AudioMute" = {
              allow-when-locked = true;
              action = [
                "wpctl"
                "set-mute"
                "@DEFAULT_AUDIO_SINK@"
                "toggle"
              ];
            };
            "XF86AudioRaiseVolume" = {
              allow-when-locked = true;
              action = [
                "wpctl"
                "set-volume"
                "@DEFAULT_AUDIO_SINK@"
                ".5%+"
              ];
            };
            "XF86AudioLowerVolume" = {
              allow-when-locked = true;
              action = [
                "wpctl"
                "set-volume"
                "@DEFAULT_AUDIO_SINK@"
                ".5%-"
              ];
            };

            "XF86MonBrightnessUp" = {
              allow-when-locked = true;
              action = [
                (lib.getExe pkgs.brightnessctl)
                "s"
                "+2%"
              ];
            };
            "XF86MonBrightnessDown" = {
              allow-when-locked = true;
              action = [
                (lib.getExe pkgs.brightnessctl)
                "s"
                "2%-"
              ];
            };

            "Mod+Tab".action = "toggle-overview";

            "Mod+Prior".action = "focus-workspace-up";
            "Mod+Next".action = "focus-workspace-down";

            "Mod+Shift+Prior".action = "move-window-up-or-to-workspace-up";
            "Mod+Shift+Next".action = "move-window-down-or-to-workspace-down";

            "Mod+Ctrl+Left".action = "focus-monitor-left";
            "Mod+Ctrl+Right".action = "focus-monitor-right";

            "Mod+Left".action = "focus-column-left";
            "Mod+Right".action = "focus-column-right";
            "Mod+Up".action = "focus-window-or-workspace-up";
            "Mod+Down".action = "focus-window-or-workspace-down";

            "Mod+Shift+Left".action = "move-column-left";
            "Mod+Shift+Right".action = "move-column-right";
            "Mod+Shift+Up".action = "move-window-up";
            "Mod+Shift+Down".action = "move-window-down";

            "Mod+R".action = "switch-preset-column-width";
            "Mod+Shift+R".action = "switch-preset-window-height";
            "Mod+Ctrl+R".action = "reset-window-height";

            "Mod+C".action = "center-window";

            "Mod+F".action = "maximize-column";
            "Mod+Ctrl+F".action = "expand-column-to-available-width";
            "Mod+Shift+F".action = "fullscreen-window";
            "Mod+Alt+F".action.set-column-width = "50%";

            "Mod+Minus".action.set-column-width = "-10%";
            "Mod+Equal".action.set-column-width = "+10%";
            "Mod+Shift+Minus".action.set-window-height = "-10%";
            "Mod+Shift+Equal".action.set-window-height = "+10%";

            "Mod+Shift+Space".action = "toggle-window-floating";

            "Mod+Shift+Return".action = [
              (lib.getExe pkgs.tgc.nirius)
              "toggle-follow-mode"
            ];

            "Mod+T".action = "toggle-column-tabbed-display";

            "Mod+Print".action = [
              (lib.getExe pkgs.hyprpicker)
              "--lowercase-hex"
              "--autocopy"
            ];

            "Print".action = "screenshot";
            "Alt+Print".action = "screenshot-window";
          }
        );
    };
  };

}