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 
185 
186 
187 
188 
189 
190 
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
209 
210 
211 
212 
213 
214 
215 
216 
217 
218 
219 
220 
221 
222 
223 
224 
225 
226 
227 
228 
229 
230 
231 
232 
233 
{
  inputs,
  config,
  lib,
  pkgs,
  ...
}:

{

  imports = [
    inputs.niriFlake.homeModules.niri
  ];

  programs.niri = {
    enable = true;
    settings = {
      input = {
        workspace-auto-back-and-forth = true;

        focus-follows-mouse = {
          enable = true;
          max-scroll-amount = "0%";
        };

        touchpad.click-method = "clickfinger";

        keyboard.xkb = {
          layout = "us,de,ru";
          variant = "mac,qwerty,mac";
          options = "grp:alt_shift_toggle";
        };
      };

      outputs."eDP-1".scale = 1;

      gestures.hot-corners.enable = false;

      layout = {
        gaps = 15;
        focus-ring = {
          width = 2;
          inactive.color = "rgba(59, 135, 86, .9)";
          active.color = "rgba(74, 169, 108, .9)";
        };
      };

      cursor.theme = "DMZ-Black";

      environment = {
        QT_QPA_PLATFORM = "wayland";
        QT_WAYLAND_FORCE_DPI = "physical";
        QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
      };

      prefer-no-csd = true;

      workspaces = {
        "01-Web".name = "Web";
        "02-Mail".name = "Mail";
        "03-Term".name = "Term";
        "04-Chat".name = "Chat";
      };

      window-rules = [
        {
          shadow.enable = true;
          matches = [
            {
              is-floating = true;
            }
          ];
        }
        {
          geometry-corner-radius = lib.genAttrs [ "bottom-left" "bottom-right" "top-left" "top-right" ] (
            name: 6.0
          );
          clip-to-geometry = true;
        }
        {
          matches = [
            {
              at-startup = true;
              app-id = "org.gnome.Fractal$";
            }
            {
              at-startup = true;
              app-id = "im.dino.Dino$";
            }
            {
              at-startup = true;
              app-id = "org.gajim.Gajim$";
            }
          ];

          open-on-workspace = "Chat";
          default-column-display = "tabbed";
        }
        {
          matches = [
            { app-id = "firefox$"; }
            { app-id = "thunderbird$"; }
          ];

          open-maximized = true;
        }
        {
          matches = [
            { app-id = "org.gnome.NautilusPreviewer$"; }
          ];

          open-floating = true;
        }
        {
          matches = [
            { app-id = "thunderbird$"; }
          ];

          open-on-workspace = "Mail";
        }
        {
          matches = [
            {
              app-id = "firefox$";
              title = "^Picture-in-Picture$";
            }
          ];

          open-floating = true;
          default-column-width.fixed = 480;
          default-window-height.fixed = 270;
          default-floating-position = {
            x = 32;
            y = 32;
            relative-to = "bottom-right";
          };
        }
      ];

      binds = with config.lib.niri.actions; {
        "Mod+Shift+E".action = quit;
        "Mod+Space".action = spawn (lib.getExe pkgs.fuzzel);
        "Mod+Return".action = spawn (lib.getExe pkgs.ghostty);

        "Mod+L".action = spawn (lib.getExe' pkgs.systemd "loginctl") "lock-session";
        "Mod+Z".action = power-off-monitors;
        # "Mod+Z".action = spawn (lib.getExe' pkgs.systemd "systemctl") "suspend";

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

        "XF86AudioRaiseVolume" = {
          allow-when-locked = true;
          action = lib.mkDefault (spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "1%+");
        };
        "XF86AudioLowerVolume" = {
          allow-when-locked = true;
          action = lib.mkDefault (spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "1%-");
        };
        "XF86MonBrightnessUp" = {
          allow-when-locked = true;
          action = lib.mkDefault (spawn (lib.getExe pkgs.brightnessctl) "s" "+5%");
        };
        "XF86MonBrightnessDown" = {
          allow-when-locked = true;
          action = lib.mkDefault (spawn (lib.getExe pkgs.brightnessctl) "s" "5%-");
        };

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

        "Mod+1".action = focus-workspace "Web";
        "Mod+2".action = focus-workspace "Mail";
        "Mod+3".action = focus-workspace "Term";
        "Mod+4".action = focus-workspace "Chat";
        "Mod+5".action = focus-workspace 5;
        "Mod+6".action = focus-workspace 6;
        "Mod+7".action = focus-workspace 7;
        "Mod+8".action = focus-workspace 8;
        "Mod+9".action = focus-workspace 9;

        "Mod+Shift+1".action.move-column-to-workspace = "Web";
        "Mod+Shift+2".action.move-column-to-workspace = "Mail";
        "Mod+Shift+3".action.move-column-to-workspace = "Term";
        "Mod+Shift+4".action.move-column-to-workspace = "Chat";
        "Mod+Shift+5".action.move-column-to-workspace = 5;
        "Mod+Shift+6".action.move-column-to-workspace = 6;
        "Mod+Shift+7".action.move-column-to-workspace = 7;
        "Mod+Shift+8".action.move-column-to-workspace = 8;
        "Mod+Shift+9".action.move-column-to-workspace = 9;

        "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+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+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+T".action = toggle-column-tabbed-display;

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

}