From b82faa4d0f951fea766b84ab6de686780e7a2486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Sat, 4 Apr 2026 22:08:22 +0200 Subject: [PATCH] feat: add niri feature --- features/desktop.nix | 1 - features/niri.nix | 141 +++++++++++++++++++++++++++++++++++++++++++ features/sway.nix | 2 + 3 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 features/niri.nix diff --git a/features/desktop.nix b/features/desktop.nix index f2e06af..100c897 100644 --- a/features/desktop.nix +++ b/features/desktop.nix @@ -22,7 +22,6 @@ enable = true; xdgOpenUsePortal = true; extraPortals = [ - pkgs.xdg-desktop-portal-wlr pkgs.xdg-desktop-portal-gtk ]; }; diff --git a/features/niri.nix b/features/niri.nix new file mode 100644 index 0000000..ae76df9 --- /dev/null +++ b/features/niri.nix @@ -0,0 +1,141 @@ +{ + nixos = + { pkgs, inputs, ... }: + { + imports = [ inputs.niri.nixosModules.niri ]; + nixpkgs.overlays = [ inputs.niri.overlays.niri ]; + + programs.niri.enable = true; + + environment.systemPackages = with pkgs; [ + swayidle + grim + slurp + wl-clipboard + brightnessctl + playerctl + pamixer + pulseaudio + cliphist + satty + wlsunset + wayland-pipewire-idle-inhibit + foot + jq + zenity + ]; + }; + + home = + { inputs, ... }: + { + imports = [ inputs.noctalia.homeModules.default ]; + + programs.noctalia-shell = { + enable = true; + systemd.enable = true; + settings = { + colorSchemes.predefinedScheme = "gruvbox"; + }; + }; + + programs.niri.settings = { + environment = { + NIXOS_OZONE_WL = "1"; + _JAVA_AWT_WM_NONREPARENTING = "1"; + }; + + spawn-at-startup = [ + { argv = [ "swayidle" "-w" ]; } + { argv = [ "wlsunset" ]; } + { argv = [ "wl-paste" "--watch" "cliphist" "store" ]; } + ]; + + input.keyboard.xkb = { }; + + binds = { + # apps + "Mod+Return".action.spawn = "ghostty"; + "Mod+Space".action.spawn = [ "sh" "-c" "qs -c noctalia-shell ipc call launcher toggle" ]; + "Mod+S".action.spawn = [ "sh" "-c" "qs -c noctalia-shell ipc call controlcenter toggle" ]; + + # window management + "Mod+Shift+Q".action.close-window = [ ]; + "Mod+H".action.focus-column-left = [ ]; + "Mod+J".action.focus-window-down = [ ]; + "Mod+K".action.focus-window-up = [ ]; + "Mod+L".action.focus-column-right = [ ]; + "Mod+Shift+H".action.move-column-left = [ ]; + "Mod+Shift+J".action.move-window-down = [ ]; + "Mod+Shift+K".action.move-window-up = [ ]; + "Mod+Shift+L".action.move-column-right = [ ]; + "Mod+F".action.maximize-column = [ ]; + "Mod+Shift+F".action.fullscreen-window = [ ]; + + # workspaces + "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; + + # media (allow-when-locked for use on lock screen) + "XF86AudioRaiseVolume" = { + action.spawn = [ "pamixer" "-i" "5" ]; + allow-when-locked = true; + }; + "XF86AudioLowerVolume" = { + action.spawn = [ "pamixer" "-d" "5" ]; + allow-when-locked = true; + }; + "XF86AudioMute" = { + action.spawn = [ "pamixer" "-t" ]; + allow-when-locked = true; + }; + "XF86MonBrightnessUp" = { + action.spawn = [ "brightnessctl" "set" "+5%" ]; + allow-when-locked = true; + }; + "XF86MonBrightnessDown" = { + action.spawn = [ "brightnessctl" "set" "5%-" ]; + allow-when-locked = true; + }; + "XF86AudioPlay" = { + action.spawn = [ "playerctl" "play-pause" ]; + allow-when-locked = true; + }; + "XF86AudioNext" = { + action.spawn = [ "playerctl" "next" ]; + allow-when-locked = true; + }; + "XF86AudioPrev" = { + action.spawn = [ "playerctl" "previous" ]; + allow-when-locked = true; + }; + + # screenshot + "Print".action.screenshot = { }; + "Shift+Print".action.screenshot-screen = { }; + + # session + "Mod+Shift+E".action.quit = { }; + "Mod+Shift+P".action.power-off-monitors = [ ]; + }; + }; + }; +} diff --git a/features/sway.nix b/features/sway.nix index 6c8a94c..a0f7a2d 100644 --- a/features/sway.nix +++ b/features/sway.nix @@ -12,6 +12,8 @@ ''; }; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; + environment.systemPackages = with pkgs; [ waybar mako