zaphyra's git: nixfiles

zaphyra's nixfiles

commit ff95394825526d243875e6dd7078fc09d428a679
parent 155c935f811212a4f31865df9f8fcb6fcbdbba3f
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Tue, 1 Jul 2025 19:44:44 +0200

config/home/zaphyra/services: add `niri`
1 file changed, 205 insertions(+), 0 deletions(-)
A
config/home/zaphyra/services/niri.nix
|
205
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/config/home/zaphyra/services/niri.nix b/config/home/zaphyra/services/niri.nix
@@ -0,0 +1,205 @@
+{
+  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 = {
+          inactive.color = "rgb(59, 135, 86)";
+          active.color = "rgb(74, 169, 108)";
+        };
+      };
+
+      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 = [
+        {
+          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";
+        }
+        {
+          matches = [
+            { app-id = "firefox$"; }
+            { app-id = "thunderbird$"; }
+          ];
+
+          open-maximized = 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+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+Prior".action = focus-workspace-up;
+        "Mod+Next".action = focus-workspace-down;
+
+        "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+Left".action = focus-column-left;
+        "Mod+Right".action = focus-column-right;
+        "Mod+Up".action = focus-window-up;
+        "Mod+Down".action = focus-window-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;
+      };
+    };
+  };
+
+}