From 20ee3460c17ea0222659294b14bfdbb9240c6363 Mon Sep 17 00:00:00 2001 From: elwrcl Date: Tue, 9 Jun 2026 14:56:33 +0300 Subject: [PATCH] niri stuff --- main/nixos/packages.nix | 10 +- modules/home/niri.nix | 9 +- modules/home/niri/config.kdl | 10 +- modules/home/niri/default.nix | 10 ++ modules/home/niri/niri/env.nix | 19 ++++ modules/home/niri/niri/execs.nix | 13 +++ modules/home/niri/niri/general.nix | 52 ++++++++++ modules/home/niri/niri/keybinds.nix | 131 ++++++++++++++++++++++++ modules/home/niri/niri/rules.nix | 47 +++++++++ modules/nixos/hardware/udev/default.nix | 1 + 10 files changed, 289 insertions(+), 13 deletions(-) create mode 100644 modules/home/niri/default.nix create mode 100644 modules/home/niri/niri/env.nix create mode 100644 modules/home/niri/niri/execs.nix create mode 100644 modules/home/niri/niri/general.nix create mode 100644 modules/home/niri/niri/keybinds.nix create mode 100644 modules/home/niri/niri/rules.nix diff --git a/main/nixos/packages.nix b/main/nixos/packages.nix index 11c3fe5..54ea0d5 100755 --- a/main/nixos/packages.nix +++ b/main/nixos/packages.nix @@ -1,4 +1,9 @@ -{ pkgs, inputs, system, ... }: +{ + pkgs, + inputs, + system, + ... +}: let uxplay-fixed = pkgs.uxplay.override { @@ -42,8 +47,7 @@ with pkgs; kdePackages.kio kdePackages.kdf - # qol-hyprland - gpu-screen-recorder + # utils wl-clipboard wf-recorder tesseract diff --git a/modules/home/niri.nix b/modules/home/niri.nix index 1ee10d3..7686b86 100644 --- a/modules/home/niri.nix +++ b/modules/home/niri.nix @@ -1,4 +1,9 @@ -{ ... }: +{ pkgs, inputs, ... }: { - xdg.configFile."niri/config.kdl".source = ./niri/config.kdl; + imports = [ ./niri/default.nix ]; + + programs.niri = { + enable = true; + package = inputs.niri.packages.${pkgs.stdenv.hostPlatform.system}.niri; + }; } diff --git a/modules/home/niri/config.kdl b/modules/home/niri/config.kdl index f222c86..0e6b11c 100644 --- a/modules/home/niri/config.kdl +++ b/modules/home/niri/config.kdl @@ -10,14 +10,13 @@ input { } mouse { - accel-speed -0.5 + accel-speed 0 accel-profile "adaptive" } touchpad { tap natural-scroll - disabled-on-typing scroll-factor 0.5 click-method "clickfinger" } @@ -26,11 +25,6 @@ input { warp-mouse-to-focus } -cursor { - theme "Bibata-Modern-Classic" - size 24 -} - environment { XCURSOR_THEME "Bibata-Modern-Classic" XCURSOR_SIZE "24" @@ -45,8 +39,8 @@ environment { DISPLAY ":0" } +spawn-at-startup "noctalia" spawn-at-startup "xwayland-satellite" -spawn-at-startup "noctalia-shell" spawn-at-startup "sh" "-c" "wl-paste --type text --watch cliphist store" spawn-at-startup "sh" "-c" "wl-paste --type image --watch cliphist store" diff --git a/modules/home/niri/default.nix b/modules/home/niri/default.nix new file mode 100644 index 0000000..3a38a52 --- /dev/null +++ b/modules/home/niri/default.nix @@ -0,0 +1,10 @@ +{ ... }: +{ + imports = [ + ./niri/env.nix + ./niri/execs.nix + ./niri/general.nix + ./niri/rules.nix + ./niri/keybinds.nix + ]; +} diff --git a/modules/home/niri/niri/env.nix b/modules/home/niri/niri/env.nix new file mode 100644 index 0000000..45d6edf --- /dev/null +++ b/modules/home/niri/niri/env.nix @@ -0,0 +1,19 @@ +{ ... }: + +{ + programs.niri.settings = { + environment = { + DISPLAY = ":0"; + XCURSOR_THEME = "Bibata-Modern-Classic"; + XCURSOR_SIZE = "24"; + QT_STYLE_OVERRIDE = "adwaita-dark"; + GDK_BACKEND = "wayland,x11"; + QT_QPA_PLATFORM = "wayland;xcb"; + QT_QPA_PLATFORMTHEME = "gtk3"; + ELECTRON_OZONE_PLATFORM_HINT = "auto"; + TERMINAL = "ghostty"; + MESA_GL_VERSION_OVERRIDE = "4.6"; + MESA_GLSL_VERSION_OVERRIDE = "460"; + }; + }; +} diff --git a/modules/home/niri/niri/execs.nix b/modules/home/niri/niri/execs.nix new file mode 100644 index 0000000..32f88f3 --- /dev/null +++ b/modules/home/niri/niri/execs.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + programs.niri.settings = { + "prefer-no-csd" = true; + spawn-at-startup = [ + { command = [ "noctalia" ]; } + { command = [ "xwayland-satellite" ]; } + { command = [ "sh" "-c" "wl-paste --type text --watch cliphist store" ]; } + { command = [ "sh" "-c" "wl-paste --type image --watch cliphist store" ]; } + ]; + }; +} \ No newline at end of file diff --git a/modules/home/niri/niri/general.nix b/modules/home/niri/niri/general.nix new file mode 100644 index 0000000..e8564c4 --- /dev/null +++ b/modules/home/niri/niri/general.nix @@ -0,0 +1,52 @@ +{ ... }: + +{ + programs.niri.settings = { + input = { + keyboard.xkb.layout = "tr"; + "repeat-delay" = 250; + "repeat-rate" = 35; + mouse = { + "accel-speed" = 0.0; + "accel-profile" = "adaptive"; + }; + touchpad = { + tap = true; + "natural-scroll" = true; + "scroll-factor" = 0.5; + "click-method" = "clickfinger"; + }; + "focus-follows-mouse" = true; + "warp-mouse-to-focus" = true; + }; + animations = { + slowdown = 0.8; + }; + layout = { + gaps = 5; + struts = { + left = 7; + right = 7; + top = 7; + bottom = 7; + }; + "center-focused-column" = "never"; + "preset-column-widths" = [ + { proportion = 0.33333; } + { proportion = 0.5; } + { proportion = 0.66667; } + ]; + "default-column-width" = { + proportion = 0.5; + }; + "focus-ring" = { + width = 2; + "active-color" = "#61afef"; + "inactive-color" = "#444444"; + }; + border = { + off = true; + }; + }; + }; +} diff --git a/modules/home/niri/niri/keybinds.nix b/modules/home/niri/niri/keybinds.nix new file mode 100644 index 0000000..ec06c38 --- /dev/null +++ b/modules/home/niri/niri/keybinds.nix @@ -0,0 +1,131 @@ +{ ... }: + +{ + programs.niri.settings = { + binds = { + # --- Workspace Navigation --- + "Ctrl+Mod+Right".action.focus-column-right = []; + "Ctrl+Mod+Left".action.focus-column-left = []; + "Ctrl+Mod+Down".action.focus-workspace-down = []; + "Ctrl+Mod+Up".action.focus-workspace-up = []; + + "Ctrl+Mod+Shift+Right".action.move-column-right = []; + "Ctrl+Mod+Shift+Left".action.move-column-left = []; + "Ctrl+Mod+Shift+Down".action.move-window-to-workspace-down = []; + "Ctrl+Mod+Shift+Up".action.move-window-to-workspace-up = []; + + # --- Interface --- + "Mod+Space".action.spawn = [ "noctalia" "msg" "panel-toggle" "launcher" ]; + "Mod+P".action.spawn = [ "noctalia" "msg" "panel-toggle" "control-center" ]; + "Mod+Tab".action.toggle-overview = []; + "Ctrl+Alt+Delete".action.spawn = [ "noctalia" "msg" "settings-toggle" ]; + + # --- Noctalia Plugins --- + "Mod+Shift+S".action.spawn = [ "noctalia" "msg" "plugin:screen-shot-and-record" "screenshot" ]; + "Mod+Shift+Z".action.spawn = [ "noctalia" "msg" "plugin:screen-shot-and-record" "search" ]; + "Mod+Shift+X".action.spawn = [ "noctalia" "msg" "plugin:screen-shot-and-record" "ocr" ]; + "Mod+Shift+C".action.spawn = [ "noctalia" "msg" "panel-toggle" "music" ]; + + # --- Launchers --- + "Mod+Return".action.spawn = [ "ghostty" ]; + "Mod+W".action.spawn = [ "zen-beta" ]; + "Mod+E".action.spawn = [ "dolphin" ]; + "Mod+Z".action.spawn = [ "code" ]; + "Mod+Alt+V".action.spawn = [ "pavucontrol" ]; + "Mod+Shift+V".action.spawn = [ "noctalia" "msg" "panel-toggle" "clipboard" ]; + "Mod+Shift+L".action.spawn = [ "noctalia" "msg" "lock" ]; + "Ctrl+Shift+Escape".action.spawn = [ "ghostty" "-e" "sudo" "btop" ]; + + # --- Window Management --- + "Mod+Q".action.close-window = []; + "Mod+Alt+Space".action.toggle-window-floating = []; + "Mod+F".action.fullscreen-window = []; + "Mod+D".action.maximize-column = []; + + # --- Focus --- + "Mod+Left".action.focus-column-left = []; + "Mod+Right".action.focus-column-right = []; + "Mod+Up".action.focus-window-up = []; + "Mod+Down".action.focus-window-down = []; + + # --- Move Windows --- + "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 = []; + + # --- Workspaces by Number --- + "Mod+1".action.focus-workspace = 1; + "Mod+2".action.focus-workspace = 2; + "Mod+3".action.focus-workspace = 3; + "Mod+4".action.focus-workspace = 4; + "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+0".action.focus-workspace = 10; + + "Mod+Shift+1".action.move-window-to-workspace = 1; + "Mod+Shift+2".action.move-window-to-workspace = 2; + "Mod+Shift+3".action.move-window-to-workspace = 3; + "Mod+Shift+4".action.move-window-to-workspace = 4; + "Mod+Shift+5".action.move-window-to-workspace = 5; + "Mod+Shift+6".action.move-window-to-workspace = 6; + "Mod+Shift+7".action.move-window-to-workspace = 7; + "Mod+Shift+8".action.move-window-to-workspace = 8; + "Mod+Shift+9".action.move-window-to-workspace = 9; + "Mod+Shift+0".action.move-window-to-workspace = 10; + + # --- Mouse Workspace Scroll --- + "Mod+WheelScrollDown" = { + "cooldown-ms" = 150; + action.focus-workspace-down = []; + }; + "Mod+WheelScrollUp" = { + "cooldown-ms" = 150; + action.focus-workspace-up = []; + }; + + # --- Media & Hardware Keys --- + "Mod+Shift+N".action.spawn = [ "playerctl" "next" ]; + "Mod+Shift+B".action.spawn = [ "playerctl" "previous" ]; + "Mod+Shift+P".action.spawn = [ "playerctl" "play-pause" ]; + + "XF86AudioRaiseVolume" = { + "allow-when-locked" = true; + action.spawn = [ "noctalia" "msg" "volume-up" ]; + }; + "XF86AudioLowerVolume" = { + "allow-when-locked" = true; + action.spawn = [ "noctalia" "msg" "volume-down" ]; + }; + "XF86AudioMute" = { + "allow-when-locked" = true; + action.spawn = [ "noctalia" "msg" "volume-mute" ]; + }; + "XF86AudioMicMute" = { + "allow-when-locked" = true; + action.spawn = [ "wpctl" "set-mute" "@DEFAULT_SOURCE@" "toggle" ]; + }; + "XF86MonBrightnessUp".action.spawn = [ "noctalia" "msg" "brightness-up" ]; + "XF86MonBrightnessDown".action.spawn = [ "noctalia" "msg" "brightness-down" ]; + "XF86AudioNext" = { + "allow-when-locked" = true; + action.spawn = [ "playerctl" "next" ]; + }; + "XF86AudioPrev" = { + "allow-when-locked" = true; + action.spawn = [ "playerctl" "previous" ]; + }; + "XF86AudioPlay" = { + "allow-when-locked" = true; + action.spawn = [ "playerctl" "play-pause" ]; + }; + "XF86AudioPause" = { + "allow-when-locked" = true; + action.spawn = [ "playerctl" "play-pause" ]; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/home/niri/niri/rules.nix b/modules/home/niri/niri/rules.nix new file mode 100644 index 0000000..43fd790 --- /dev/null +++ b/modules/home/niri/niri/rules.nix @@ -0,0 +1,47 @@ +{ ... }: + +{ + programs.niri.settings = { + window-rules = [ + { + matches = [ { title = "Open File.*"; } ]; + open-floating = true; + } + { + matches = [ { title = "Save As.*"; } ]; + open-floating = true; + } + { + matches = [ { title = "File Upload.*"; } ]; + open-floating = true; + } + { + matches = [ { "app-id" = "pavucontrol"; } ]; + open-floating = true; + default-column-width = { fixed = 800; }; + } + { + matches = [ { title = "(?i)picture.in.picture"; } ]; + open-floating = true; + } + { + matches = [ { "app-id" = "steam"; } ]; + open-floating = true; + } + { + matches = [ { "app-id" = "steam"; title = "Steam"; } ]; + open-floating = false; + } + { + matches = [ { "app-id" = "steam"; title = "^notificationtoasts_.*"; } ]; + open-floating = true; + open-focused = false; + default-floating-position = { + x = 20; + y = 20; + "relative-to" = "bottom-right"; + }; + } + ]; + }; +} \ No newline at end of file diff --git a/modules/nixos/hardware/udev/default.nix b/modules/nixos/hardware/udev/default.nix index 875fd48..130821c 100755 --- a/modules/nixos/hardware/udev/default.nix +++ b/modules/nixos/hardware/udev/default.nix @@ -1,6 +1,7 @@ { ... }: { + programs.gpu-screen-recorder.enable = true; services.udev.extraRules = '' KERNEL=="ttyACM[0-9]*", MODE="0666" KERNEL=="ttyUSB[0-9]*", MODE="0666"