From 55dfbc577b22471a5f4475089c49bd9942bbae4b Mon Sep 17 00:00:00 2001 From: elwrcl Date: Sun, 19 Apr 2026 17:15:26 +0300 Subject: [PATCH] add: niri Signed-off-by: elwrcl --- home/niri.nix | 7 ++ home/niri/defaul.nix | 18 +++++ home/niri/niri/env.nix | 17 +++++ home/niri/niri/execs.nix | 6 ++ home/niri/niri/general.nix | 78 +++++++++++++++++++++ home/niri/niri/keybinds.nix | 95 ++++++++++++++++++++++++++ home/niri/niri/rules.nix | 45 ++++++++++++ nixos/desktop/window-managers/niri.nix | 43 ++++++++++++ 8 files changed, 309 insertions(+) create mode 100644 home/niri.nix create mode 100644 home/niri/defaul.nix create mode 100644 home/niri/niri/env.nix create mode 100644 home/niri/niri/execs.nix create mode 100644 home/niri/niri/general.nix create mode 100644 home/niri/niri/keybinds.nix create mode 100644 home/niri/niri/rules.nix create mode 100644 nixos/desktop/window-managers/niri.nix diff --git a/home/niri.nix b/home/niri.nix new file mode 100644 index 0000000..768c7c0 --- /dev/null +++ b/home/niri.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./niri/default.nix + ]; +} diff --git a/home/niri/defaul.nix b/home/niri/defaul.nix new file mode 100644 index 0000000..e11c50d --- /dev/null +++ b/home/niri/defaul.nix @@ -0,0 +1,18 @@ +{ lib, ... }: + +let + env = import ./niri/env.nix; + execs = import ./niri/execs.nix; + general = import ./niri/general.nix; + rules = import ./niri/rules.nix; + keybinds = import ./niri/keybinds.nix; +in +{ + xdg.configFile."niri/config.kdl".text = lib.concatStringsSep "\n" [ + env + execs + general + rules + keybinds + ]; +} diff --git a/home/niri/niri/env.nix b/home/niri/niri/env.nix new file mode 100644 index 0000000..72402a7 --- /dev/null +++ b/home/niri/niri/env.nix @@ -0,0 +1,17 @@ +'' + environment { + XCURSOR_SIZE "24" + XCURSOR_THEME "Bibata-Modern-Classic" + XDG_SESSION_TYPE "wayland" + XDG_CURRENT_DESKTOP "niri" + XDG_SESSION_DESKTOP "niri" + GDK_BACKEND "wayland,x11" + QT_QPA_PLATFORM "wayland;xcb" + QT_QPA_PLATFORMTHEME "gtk3" + QT_STYLE_OVERRIDE "adwaita-dark" + ELECTRON_OZONE_PLATFORM_HINT "auto" + TERMINAL "ghostty" + MESA_GL_VERSION_OVERRIDE "4.6" + MESA_GLSL_VERSION_OVERRIDE "460" + } +'' diff --git a/home/niri/niri/execs.nix b/home/niri/niri/execs.nix new file mode 100644 index 0000000..c9ef1c3 --- /dev/null +++ b/home/niri/niri/execs.nix @@ -0,0 +1,6 @@ +'' + spawn-at-startup "noctalia-shell" + spawn-at-startup "easyeffects" "--hide-window" "--service-mode" + spawn-at-startup "wl-paste" "--type" "text" "--watch" "cliphist" "store" + spawn-at-startup "wl-paste" "--type" "image" "--watch" "cliphist" "store" +'' diff --git a/home/niri/niri/general.nix b/home/niri/niri/general.nix new file mode 100644 index 0000000..8bff258 --- /dev/null +++ b/home/niri/niri/general.nix @@ -0,0 +1,78 @@ +'' + prefer-no-csd + + debug { + honor-xdg-activation-with-invalid-serial + } + + input { + keyboard { + xkb { + layout "tr" + } + numlock + repeat-delay 250 + repeat-rate 35 + } + + mouse { + accel-profile "flat" + accel-speed 0.0 + } + + touchpad { + natural-scroll + dwt + click-method "clickfinger" + scroll-factor 0.8 + } + + focus-follows-mouse + } + + layout { + gaps 5 + + center-focused-column "never" + + focus-ring { + width 1 + active-color "#33ccffee" + inactive-color "#31313600" + } + + default-column-width {} + } + + window-rule { + geometry-corner-radius 18 + clip-to-geometry true + } + + animations { + window-open { + duration-ms 250 + curve "ease-out-expo" + } + window-close { + duration-ms 200 + curve "ease-out-expo" + } + horizontal-view-movement { + duration-ms 350 + curve "ease-out-expo" + } + workspace-switch { + duration-ms 350 + curve "ease-out-expo" + } + window-movement { + duration-ms 250 + curve "ease-out-expo" + } + window-resize { + duration-ms 250 + curve "ease-out-expo" + } + } +'' diff --git a/home/niri/niri/keybinds.nix b/home/niri/niri/keybinds.nix new file mode 100644 index 0000000..15ba3d2 --- /dev/null +++ b/home/niri/niri/keybinds.nix @@ -0,0 +1,95 @@ +'' + binds { + Mod+Space { spawn "noctalia-shell" "ipc" "call" "launcher" "toggle"; } + + // Workspace navigation + Ctrl+Mod+Right { focus-workspace-down; } + Ctrl+Mod+Left { focus-workspace-up; } + + // Interface + Mod+Tab { spawn "noctalia-shell" "ipc" "call" "launcher" "windows"; } + Mod+P { spawn "noctalia-shell" "ipc" "call" "bar" "toggle"; } + Ctrl+Alt+Delete { spawn "noctalia-shell" "ipc" "call" "sessionMenu" "toggle"; } + + // Plugins + Mod+Shift+S { spawn "noctalia-shell" "ipc" "call" "plugin:screen-shot-and-record" "screenshot"; } + Mod+Shift+Z { spawn "noctalia-shell" "ipc" "call" "plugin:screen-shot-and-record" "search"; } + Mod+Shift+X { spawn "noctalia-shell" "ipc" "call" "plugin:screen-shot-and-record" "ocr"; } + Mod+Shift+C { spawn "noctalia-shell" "ipc" "call" "plugin:music" "panel"; } + + // Launchers + Mod+Return { spawn "ghostty"; } + Mod+W { spawn "zen-beta"; } + Mod+E { spawn "nautilus"; } + Mod+Z { spawn "zeditor"; } + Mod+Alt+V { spawn "pavucontrol"; } + Mod+Shift+V { spawn "noctalia-shell" "ipc" "call" "launcher" "clipboard"; } + Mod+Shift+L { spawn "noctalia-shell" "ipc" "call" "lockScreen" "lock"; } + Ctrl+Shift+Escape { spawn "ghostty" "-e" "btop"; } + + // Window management + Mod+Q { close-window; } + Mod+F { fullscreen-window; } + Mod+D { maximize-column; } + // togglefloating ve pin Niri'de yok + + // Focus + Mod+Left { focus-column-left; } + Mod+Right { focus-column-right; } + Mod+Up { focus-window-up; } + Mod+Down { focus-window-down; } + + // Move windows + Mod+Shift+Left { move-column-left; } + Mod+Shift+Right { move-column-right; } + Mod+Shift+Up { move-window-up; } + Mod+Shift+Down { move-window-down; } + + // Workspace navigation (absolute) + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Mod+0 { focus-workspace 10; } + + // Move window to workspace + Mod+Shift+1 { move-column-to-workspace 1; } + Mod+Shift+2 { move-column-to-workspace 2; } + Mod+Shift+3 { move-column-to-workspace 3; } + Mod+Shift+4 { move-column-to-workspace 4; } + Mod+Shift+5 { move-column-to-workspace 5; } + Mod+Shift+6 { move-column-to-workspace 6; } + Mod+Shift+7 { move-column-to-workspace 7; } + Mod+Shift+8 { move-column-to-workspace 8; } + Mod+Shift+9 { move-column-to-workspace 9; } + Mod+Shift+0 { move-column-to-workspace 10; } + + // Media + Mod+Shift+N { spawn "playerctl" "next"; } + Mod+Shift+B { spawn "playerctl" "previous"; } + Mod+Shift+P { spawn "playerctl" "play-pause"; } + + // Mouse binds + Mod+BTN_LEFT { move-window-with-mouse; } + Mod+BTN_RIGHT { resize-window-with-mouse; } + + // Volume & brightness + XF86AudioRaiseVolume allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "volume" "increase"; } + XF86AudioLowerVolume allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "volume" "decrease"; } + XF86MonBrightnessUp allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "brightness" "increase"; } + XF86MonBrightnessDown allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "brightness" "decrease"; } + + // Media keys + XF86AudioMute allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "volume" "muteOutput"; } + XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_SOURCE@" "toggle"; } + XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; } + XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; } + XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; } + XF86AudioPause allow-when-locked=true { spawn "playerctl" "play-pause"; } + } +'' diff --git a/home/niri/niri/rules.nix b/home/niri/niri/rules.nix new file mode 100644 index 0000000..c4d8ee5 --- /dev/null +++ b/home/niri/niri/rules.nix @@ -0,0 +1,45 @@ +'' + layer-rule { + match namespace="^noctalia-overview.*" + place-within-backdrop true + } + + window-rule { + match title=r#"^(Open File)(.*)$"# + open-floating true + } + + window-rule { + match title=r#"^(Save As)(.*)$"# + open-floating true + } + + window-rule { + match title=r#"^(File Upload)(.*)$"# + open-floating true + } + + window-rule { + match app-id=r#"^pavucontrol$"# + open-floating true + default-column-width { proportion 0.45; } + } + + // Picture-in-Picture — pin desteklenmiyor niri'de + window-rule { + match title=r#"(?i)^picture.in.picture"# + open-floating true + } + + // Steam: ana pencere tiled, diğerleri floating + window-rule { + match app-id=r#"^steam$"# + open-floating true + } + + window-rule { + match app-id=r#"^steam$"# + match title=r#"^Steam$"# + open-floating false + } +'' diff --git a/nixos/desktop/window-managers/niri.nix b/nixos/desktop/window-managers/niri.nix new file mode 100644 index 0000000..ae3ae60 --- /dev/null +++ b/nixos/desktop/window-managers/niri.nix @@ -0,0 +1,43 @@ +{ pkgs, lib, ... }: + +{ + programs.niri.enable = true; + + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-gnome + xdg-desktop-portal-gtk + ]; + config.niri = lib.mkForce { + default = [ + "gnome" + "gtk" + ]; + "org.freedesktop.impl.portal.FileChooser" = [ "gtk" ]; + }; + }; + + services = { + dbus.enable = true; + pipewire = { + enable = true; + pulse.enable = true; + wireplumber.enable = true; + }; + gnome = { + gnome-keyring.enable = true; + gnome-settings-daemon.enable = lib.mkDefault false; + }; + }; + + security.polkit.enable = true; + environment.systemPackages = with pkgs; [ + glib + dconf + dconf-editor + xdg-utils + xdg-user-dirs + ]; +}