From ee79042aa19a7edea470ec396ba68d0469ae98b2 Mon Sep 17 00:00:00 2001 From: imxyy_soope_ Date: Wed, 8 Jul 2026 20:08:15 +0800 Subject: [PATCH] niri: migrate to niri-nix (https://codeberg.org/bananad3v/niri-nix) --- flake.lock | 73 +---- flake.nix | 5 +- flake/hosts.nix | 3 +- flake/pkgs.nix | 2 +- hosts/imxyy-nix-x16/home.nix | 18 +- hosts/imxyy-nix/home.nix | 32 +- modules/desktop/wm/niri/config.kdl | 76 ++++- modules/desktop/wm/niri/config.nix | 359 +++------------------- modules/desktop/wm/niri/config/binds.kdl | 91 ++++++ modules/desktop/wm/niri/config/config.kdl | 78 +++++ modules/desktop/wm/niri/config/rules.kdl | 38 +++ modules/desktop/wm/niri/default.nix | 17 +- modules/i18n/fcitx5.nix | 6 +- 13 files changed, 386 insertions(+), 412 deletions(-) create mode 100644 modules/desktop/wm/niri/config/binds.kdl create mode 100644 modules/desktop/wm/niri/config/config.kdl create mode 100644 modules/desktop/wm/niri/config/rules.kdl diff --git a/flake.lock b/flake.lock index 3340246..a9f78e4 100644 --- a/flake.lock +++ b/flake.lock @@ -625,58 +625,36 @@ "url": "https://git.imxyy.top/imxyy1soope1/flake-templates" } }, - "niri": { + "niri-nix": { "inputs": { - "niri-stable": "niri-stable", "niri-unstable": "niri-unstable", "nixpkgs": [ "nixpkgs" ], - "nixpkgs-stable": [ - "nixpkgs-stable" - ], - "xwayland-satellite-stable": "xwayland-satellite-stable", "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1783510829, - "narHash": "sha256-VtZC3AiKp3w6oCTRlEaraI9Fi2T8CmdDuhzGf3lNG9M=", - "owner": "sodiboo", - "repo": "niri-flake", - "rev": "ba8fc95733e53354e82dd1a821d8391dcd56e4bc", - "type": "github" + "lastModified": 1783966637, + "narHash": "sha256-hOP+6qnU9fUNj81Pf//PZ31rT5DPilMKitijMtBi12c=", + "ref": "refs/heads/main", + "rev": "889b49712d22394e0d21402d0d4d502d40c309b0", + "revCount": 141, + "type": "git", + "url": "https://codeberg.org/bananad3v/niri-nix" }, "original": { - "owner": "sodiboo", - "repo": "niri-flake", - "type": "github" - } - }, - "niri-stable": { - "flake": false, - "locked": { - "lastModified": 1756556321, - "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", - "owner": "YaLTeR", - "repo": "niri", - "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", - "type": "github" - }, - "original": { - "owner": "YaLTeR", - "ref": "v25.08", - "repo": "niri", - "type": "github" + "type": "git", + "url": "https://codeberg.org/bananad3v/niri-nix" } }, "niri-unstable": { "flake": false, "locked": { - "lastModified": 1783506058, - "narHash": "sha256-LyuNO/1BM7GphVyt4C4Qj2OkdHZvM/9Hxs7mQ5ExjYc=", + "lastModified": 1783522755, + "narHash": "sha256-dI0HkX1djETia7cD/Y64h8BNIsSOfTRMzfNum2J6UhE=", "owner": "YaLTeR", "repo": "niri", - "rev": "ef5b7379dc444d33b01a7faec2bd6592d3188357", + "rev": "0777769e719b7c9b7c980d4ea66288bfbb4da5b3", "type": "github" }, "original": { @@ -989,7 +967,7 @@ "infuse": "infuse", "llm-agents": "llm-agents", "my-templates": "my-templates", - "niri": "niri", + "niri-nix": "niri-nix", "nixos-wsl": "nixos-wsl", "nixpkgs": [ "nixpkgs-unstable" @@ -1244,31 +1222,14 @@ "type": "github" } }, - "xwayland-satellite-stable": { - "flake": false, - "locked": { - "lastModified": 1755491097, - "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", - "owner": "Supreeeme", - "repo": "xwayland-satellite", - "rev": "388d291e82ffbc73be18169d39470f340707edaa", - "type": "github" - }, - "original": { - "owner": "Supreeeme", - "ref": "v0.7", - "repo": "xwayland-satellite", - "type": "github" - } - }, "xwayland-satellite-unstable": { "flake": false, "locked": { - "lastModified": 1781226823, - "narHash": "sha256-28696iIw8uE0ZUyFTtzhEM8xMh85clCYypMxkvUi+sc=", + "lastModified": 1783895132, + "narHash": "sha256-Dl0Gvrig3EpE962hzF3ETPhUztlfuRhcmlpd8ioHN54=", "owner": "Supreeeme", "repo": "xwayland-satellite", - "rev": "8575d0ef55d70f9b4c46b6bffb3accf912217e1e", + "rev": "a2b5c635d8c8c99b286967658d0d177044887eb8", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2cfec0b..0bd66d8 100644 --- a/flake.nix +++ b/flake.nix @@ -96,10 +96,9 @@ inputs.systems.follows = "systems"; inputs.treefmt-nix.follows = "treefmt"; }; - niri = { - url = "github:sodiboo/niri-flake"; + niri-nix = { + url = "git+https://codeberg.org/bananad3v/niri-nix"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.nixpkgs-stable.follows = "nixpkgs-stable"; }; noctalia = { url = "github:noctalia-dev/noctalia-shell/v4.7.5"; diff --git a/flake/hosts.nix b/flake/hosts.nix index 3c720bc..41a7ec9 100644 --- a/flake/hosts.nix +++ b/flake/hosts.nix @@ -16,6 +16,7 @@ let home-manager = { sharedModules = [ # keep-sorted start + inputs.niri-nix.homeModules.default inputs.noctalia.homeModules.default inputs.sops-nix.homeManagerModules.sops inputs.stylix.homeModules.stylix @@ -128,7 +129,7 @@ in inputs.angrr.nixosModules.angrr inputs.home-manager.nixosModules.default inputs.impermanence.nixosModules.impermanence - inputs.niri.nixosModules.niri + inputs.niri-nix.nixosModules.default inputs.sops-nix.nixosModules.sops # keep-sorted end diff --git a/flake/pkgs.nix b/flake/pkgs.nix index a2f87e7..4e3b12d 100644 --- a/flake/pkgs.nix +++ b/flake/pkgs.nix @@ -10,7 +10,7 @@ pkgsParams = { overlays = builtins.attrValues config.flake.overlays ++ [ inputs.go-musicfox.overlays.default - inputs.niri.overlays.niri + inputs.niri-nix.overlays.niri-nix inputs.fenix.overlays.default inputs.angrr.overlays.default (final: prev: { diff --git a/hosts/imxyy-nix-x16/home.nix b/hosts/imxyy-nix-x16/home.nix index 9dba200..9c758b0 100644 --- a/hosts/imxyy-nix-x16/home.nix +++ b/hosts/imxyy-nix-x16/home.nix @@ -34,19 +34,15 @@ set -gp PATH $HOME/bin ''; - programs.niri.settings = { + wayland.windowManager.niri.settings = { environment.STEAM_FORCE_DESKTOPUI_SCALING = "1.25"; - outputs = { - eDP-1 = { - enable = true; - mode = { - width = 1920; - height = 1200; - refresh = 60.002; - }; + output = [ + { + _args = [ "eDP-1" ]; + mode = "1920x1200@60.002"; scale = 1.25; - }; - }; + } + ]; }; }; diff --git a/hosts/imxyy-nix/home.nix b/hosts/imxyy-nix/home.nix index 940baa1..cc94256 100644 --- a/hosts/imxyy-nix/home.nix +++ b/hosts/imxyy-nix/home.nix @@ -48,32 +48,24 @@ ''; }; - programs.niri.settings = { + wayland.windowManager.niri.settings = { environment.STEAM_FORCE_DESKTOPUI_SCALING = "1.25"; - outputs = { - DP-1 = { - enable = true; - mode = { - width = 2560; - height = 1440; - refresh = 75.033; - }; + output = [ + { + _args = [ "DP-1" ]; + mode = "2560x1440@75.033"; scale = 1.25; - position = { + position._props = { x = 0; y = 0; }; - }; - DP-2 = { - enable = true; - mode = { - width = 2560; - height = 1440; - refresh = 75.033; - }; + } + { + _args = [ "DP-2" ]; + mode = "2560x1440@75.033"; scale = 1.25; - }; - }; + } + ]; }; }; diff --git a/modules/desktop/wm/niri/config.kdl b/modules/desktop/wm/niri/config.kdl index 112dd8e..d53d6bc 100644 --- a/modules/desktop/wm/niri/config.kdl +++ b/modules/desktop/wm/niri/config.kdl @@ -1,9 +1,57 @@ -include "generated-config.kdl" +include "generated.kdl" + +input { + focus-follows-mouse max-scroll-amount="0%" + workspace-auto-back-and-forth +} layout { + gaps 23 + center-focused-column "on-overflow" + always-center-single-column + + focus-ring { + off + } + border { on + width 4 + inactive-color "#2e2e3eee" + active-gradient from="#6186d6ee" to="#cba6f7ee" angle=180 relative-to="workspace-view" } + + insert-hint { + color "rgba(42, 44, 54, 0.5)" + } + + preset-column-widths { + proportion 0.33333 + proportion 0.4 + proportion 0.5 + proportion 0.6 + proportion 0.66667 + proportion 0.8 + } + + default-column-width { proportion 0.8; } + + background-color "transparent" + + tab-indicator { + width 10 + place-within-column + } +} + +prefer-no-csd + +hotkey-overlay { + skip-at-startup +} + +clipboard { + disable-primary } blur { @@ -13,6 +61,25 @@ blur { saturation 1.5 } +layer-rule { + match namespace="^wallpaper$" + place-within-backdrop true +} + +overview { + workspace-shadow { + off + } +} + +animations { + on + slowdown 1.5 + workspace-switch { + spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 + } +} + window-rule { draw-border-with-background false geometry-corner-radius 14.000000 14.000000 14.000000 14.000000 @@ -39,3 +106,10 @@ window-rule { match app-id="org.gnome.Nautilus" opacity 0.6 } + +window-rule { + match app-id="org.jackhuang.hmcl.Launcher" + border { + off + } +} diff --git a/modules/desktop/wm/niri/config.nix b/modules/desktop/wm/niri/config.nix index ebbaebb..9bf565c 100644 --- a/modules/desktop/wm/niri/config.nix +++ b/modules/desktop/wm/niri/config.nix @@ -7,334 +7,69 @@ ... }: let - settings = config.my.hm.programs.niri.settings; + niriCfg = config.my.hm.wayland.windowManager.niri; in { config = lib.mkIf config.my.desktop.wm.niri.enable { my.hm = { - xdg.configFile.niri-config.target = lib.mkForce "niri/generated-config.kdl"; - xdg.configFile."niri/config.kdl".source = impure.mkImpureLink ./config.kdl; - - programs.niri.settings = { - input = { - focus-follows-mouse = { - enable = true; - max-scroll-amount = "0%"; - }; - workspace-auto-back-and-forth = true; - }; - - layout = { - gaps = 23; - center-focused-column = "on-overflow"; - always-center-single-column = true; - focus-ring.enable = false; - border = { - enable = true; - width = 4; - - inactive.color = "#2e2e3eee"; - active.gradient = { - from = "#6186d6ee"; - to = "#cba6f7ee"; - angle = 180; - relative-to = "workspace-view"; - }; - }; - insert-hint = { - enable = true; - display.color = "rgba(42, 44, 54, 0.5)"; - }; - preset-column-widths = [ - { proportion = 0.33333; } - { proportion = 0.4; } - { proportion = 0.5; } - { proportion = 0.6; } - { proportion = 0.66667; } - { proportion = 0.8; } - ]; - default-column-width.proportion = 0.8; - background-color = "transparent"; - tab-indicator = { - width = 10; - place-within-column = true; - }; - }; - - animations = { - enable = true; - slowdown = 1.5; - workspace-switch.kind.spring = { - damping-ratio = 1.0; - stiffness = 1000; - epsilon = 0.0001; - }; - }; - - prefer-no-csd = true; - hotkey-overlay.skip-at-startup = true; - - clipboard.disable-primary = true; - - layer-rules = [ - { - matches = [ { namespace = "^wallpaper$"; } ]; - place-within-backdrop = true; - } - ]; - overview.workspace-shadow.enable = false; + xdg.configFile."niri".source = impure.mkImpureLink ./config; + xdg.configFile."niri-generated.kdl".text = niriCfg.finalConfig; + wayland.windowManager.niri.settings = { environment.NIXOS_OZONE_WL = "1"; - spawn-at-startup = lib.mkBefore ( - map (c: { command = c; }) [ - ( - [ - "dbus-update-activation-environment" - "--systemd" - ] - ++ builtins.attrNames settings.environment - ) - + spawn-at-startup = lib.mkBefore [ + ( [ - "${lib.getExe pkgs.swaybg}" - "-m" - "fill" - "-i" - (toString assets.wallpaper) - ] - [ - "wl-paste" - "--type" - "text" - "--watch" - "cliphist" - "store" - ] - [ - "wl-paste" - "--type" - "image" - "--watch" - "cliphist" - "store" - ] - [ - "noctalia-shell" + "dbus-update-activation-environment" + "--systemd" ] + ++ (builtins.attrNames niriCfg.settings.environment) + ) + [ + "${lib.getExe pkgs.swaybg}" + "-m" + "fill" + "-i" + (toString assets.wallpaper) ] - ); + [ + "wl-paste" + "--type" + "text" + "--watch" + "cliphist" + "store" + ] + [ + "wl-paste" + "--type" + "image" + "--watch" + "cliphist" + "store" + ] + [ "noctalia-shell" ] + ]; - binds = - let - noctalia = - cmd: - [ - "noctalia-shell" - "ipc" - "call" - ] - ++ (lib.splitString " " cmd); - in - with config.my.hm.lib.niri.actions; + binds = lib.mkMerge [ { - "Mod+Return".action.spawn = [ - "kitty" - "-1" - ]; - "Mod+G".action.spawn = [ config.my.desktop.browser.default.command ]; - "Mod+E".action.spawn = [ "nautilus" ]; - "Mod+R".action.spawn = noctalia "launcher toggle"; - "Mod+V".action.spawn = noctalia "launcher clipboard"; - "Mod+W".action.spawn = noctalia "launcher windows"; - "Ctrl+Alt+Escape".action.spawn = [ "missioncenter" ]; - - "XF86AudioRaiseVolume" = { - allow-when-locked = true; - action.spawn = [ - "wpctl" - "set-volume" - "@DEFAULT_SINK@" - "2%+" - ]; - }; - "XF86AudioLowerVolume" = { - allow-when-locked = true; - action.spawn = [ - "wpctl" - "set-volume" - "@DEFAULT_SINK@" - "2%-" - ]; - }; - "XF86AudioMute" = { - allow-when-locked = true; - action.spawn = noctalia "media playPause"; - }; - "Super+XF86AudioRaiseVolume" = { - allow-when-locked = true; - action.spawn = noctalia "media next"; - }; - "Super+XF86AudioLowerVolume" = { - allow-when-locked = true; - action.spawn = noctalia "media previous"; - }; - - "XF86MonBrightnessUp" = { - allow-when-locked = true; - action.spawn = [ - "brightnessctl" - "set" - "+5%" - ]; - }; - "XF86MonBrightnessDown" = { - allow-when-locked = true; - action.spawn = [ - "brightnessctl" - "set" - "5%-" - ]; - }; - "Alt+XF86AudioRaiseVolume" = { - allow-when-locked = true; - action.spawn = [ - "brightnessctl" - "set" - "+5%" - ]; - }; - "Alt+XF86AudioLowerVolume" = { - allow-when-locked = true; - action.spawn = [ - "brightnessctl" - "set" - "5%-" - ]; - }; - - "Mod+Q".action = close-window; - - "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+Ctrl+Left".action = move-column-left; - "Mod+Ctrl+Right".action = move-column-right; - "Mod+Ctrl+Up".action = move-window-up; - "Mod+Ctrl+Down".action = move-window-down; - - "Mod+Alt+Left".action = consume-or-expel-window-left; - "Mod+Alt+Right".action = consume-or-expel-window-right; - - "Mod+Shift+Left".action = focus-monitor-left; - "Mod+Shift+Right".action = focus-monitor-right; - "Mod+Shift+Up".action = focus-monitor-up; - "Mod+Shift+Down".action = focus-monitor-down; - - "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left; - "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right; - "Mod+Shift+Ctrl+Up".action = move-column-to-monitor-up; - "Mod+Shift+Ctrl+Down".action = move-column-to-monitor-down; - - "Mod+Page_Up".action = focus-workspace-up; - "Mod+Page_Down".action = focus-workspace-down; - - "Mod+Ctrl+Page_Up".action = move-column-to-workspace-up; - "Mod+Ctrl+Page_Down".action = move-column-to-workspace-down; - - "Mod+Shift+Page_Up".action = move-workspace-up; - "Mod+Shift+Page_Down".action = move-workspace-down; - - "Mod+L".action = switch-preset-column-width; - "Mod+Shift+L".action = reset-window-height; - "Mod+M".action = maximize-column; - "Mod+Shift+M".action = fullscreen-window; - "Mod+C".action = center-column; - "Mod+F".action = toggle-window-floating; - "Mod+H".action = expand-column-to-available-width; - "Mod+T".action = toggle-column-tabbed-display; - - "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%"; - - "Ctrl+Alt+A".action.screenshot = { - show-pointer = false; - }; - # "Ctrl+Alt+A".action = screenshot; - "Print".action.screenshot-screen = { - show-pointer = false; - }; - "Alt+Print".action.screenshot-window = [ ]; - # "Alt+Print".action = screenshot-window; - - "Mod+Shift+E".action = quit; - - "Mod+O".action = toggle-overview; - "Super+Tab".action = toggle-overview; - - "Mod+WheelScrollDown" = { - cooldown-ms = 150; - action = focus-workspace-down; - }; - "Mod+WheelScrollUp" = { - cooldown-ms = 150; - action = focus-workspace-up; - }; - "Mod+Ctrl+WheelScrollDown" = { - cooldown-ms = 150; - action = move-workspace-down; - }; - "Mod+Ctrl+WheelScrollUp" = { - cooldown-ms = 150; - action = move-workspace-up; - }; - - "Mod+WheelScrollRight" = { - cooldown-ms = 150; - action = focus-column-right; - }; - "Mod+WheelScrollLeft" = { - cooldown-ms = 150; - action = focus-column-left; - }; - "Mod+Ctrl+WheelScrollRight" = { - cooldown-ms = 150; - action = move-column-right; - }; - "Mod+Ctrl+WheelScrollLeft" = { - cooldown-ms = 150; - action = move-column-left; - }; - - "Mod+Shift+WheelScrollDown" = { - cooldown-ms = 150; - action = focus-column-right; - }; - "Mod+Shift+WheelScrollUp" = { - cooldown-ms = 150; - action = focus-column-left; - }; - "Mod+Ctrl+Shift+WheelScrollDown" = { - cooldown-ms = 150; - action = move-column-right; - }; - "Mod+Ctrl+Shift+WheelScrollUp" = { - cooldown-ms = 150; - action = move-column-left; - }; + "Mod+G".spawn = [ config.my.desktop.browser.default.command ]; } - // lib.attrsets.mergeAttrsList ( + (builtins.listToAttrs ( map (n: { - "Mod+${toString n}".action.focus-workspace = n; - "Mod+Shift+${toString n}".action.move-column-to-workspace = n; + name = "Mod+${toString n}"; + value.focus-workspace = n; }) (lib.range 0 9) - ); + )) + (builtins.listToAttrs ( + map (n: { + name = "Mod+Shift+${toString n}"; + value.move-column-to-workspace = n; + }) (lib.range 0 9) + )) + ]; }; - }; }; } diff --git a/modules/desktop/wm/niri/config/binds.kdl b/modules/desktop/wm/niri/config/binds.kdl new file mode 100644 index 0000000..6446084 --- /dev/null +++ b/modules/desktop/wm/niri/config/binds.kdl @@ -0,0 +1,91 @@ +binds { + Mod+Return { spawn "kitty" "-1"; } + Mod+E { spawn "nautilus"; } + Ctrl+Alt+Escape { spawn "missioncenter"; } + + Mod+R { spawn "noctalia-shell" "ipc" "call" "launcher" "toggle"; } + Mod+V { spawn "noctalia-shell" "ipc" "call" "launcher" "clipboard"; } + Mod+W { spawn "noctalia-shell" "ipc" "call" "launcher" "windows"; } + + XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_SINK@" "2%+"; } + XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_SINK@" "2%-"; } + XF86AudioMute allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "media" "playPause"; } + Super+XF86AudioRaiseVolume allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "media" "next"; } + Super+XF86AudioLowerVolume allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "media" "previous"; } + + XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "set" "+5%"; } + XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "set" "5%-"; } + Alt+XF86AudioRaiseVolume allow-when-locked=true { spawn "brightnessctl" "set" "+5%"; } + Alt+XF86AudioLowerVolume allow-when-locked=true { spawn "brightnessctl" "set" "5%-"; } + + Mod+Q { close-window; } + Mod+Shift+E { quit; } + + Mod+Left { focus-column-left; } + Mod+Right { focus-column-right; } + Mod+Up { focus-window-up; } + Mod+Down { focus-window-down; } + + Mod+Ctrl+Left { move-column-left; } + Mod+Ctrl+Right { move-column-right; } + Mod+Ctrl+Up { move-window-up; } + Mod+Ctrl+Down { move-window-down; } + + Mod+Alt+Left { consume-or-expel-window-left; } + Mod+Alt+Right { consume-or-expel-window-right; } + + Mod+Shift+Left { focus-monitor-left; } + Mod+Shift+Right { focus-monitor-right; } + Mod+Shift+Up { focus-monitor-up; } + Mod+Shift+Down { focus-monitor-down; } + + Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } + Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } + Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } + Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } + + Mod+Page_Up { focus-workspace-up; } + Mod+Page_Down { focus-workspace-down; } + + Mod+Ctrl+Page_Up { move-column-to-workspace-up; } + Mod+Ctrl+Page_Down { move-column-to-workspace-down; } + + Mod+Shift+Page_Up { move-workspace-up; } + Mod+Shift+Page_Down { move-workspace-down; } + + Mod+L { switch-preset-column-width; } + Mod+Shift+L { reset-window-height; } + Mod+M { maximize-column; } + Mod+Shift+M { fullscreen-window; } + Mod+C { center-column; } + Mod+F { toggle-window-floating; } + Mod+H { expand-column-to-available-width; } + Mod+T { toggle-column-tabbed-display; } + + Mod+Equal { set-column-width "+10%"; } + Mod+Minus { set-column-width "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } + Mod+Shift+Minus { set-window-height "-10%"; } + + Ctrl+Alt+A { screenshot show-pointer=false; } + Print { screenshot-screen show-pointer=false; } + Alt+Print { screenshot-window; } + + Mod+O { toggle-overview; } + Super+Tab { toggle-overview; } + + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+WheelScrollLeft cooldown-ms=150 { focus-column-left; } + Mod+WheelScrollRight cooldown-ms=150 { focus-column-right; } + + Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-workspace-up; } + Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-workspace-down; } + Mod+Ctrl+WheelScrollLeft cooldown-ms=150 { move-column-left; } + Mod+Ctrl+WheelScrollRight cooldown-ms=150 { move-column-right; } + + Mod+Shift+WheelScrollUp cooldown-ms=150 { focus-column-left; } + Mod+Shift+WheelScrollDown cooldown-ms=150 { focus-column-right; } + Mod+Ctrl+Shift+WheelScrollUp cooldown-ms=150 { move-column-left; } + Mod+Ctrl+Shift+WheelScrollDown cooldown-ms=150 { move-column-right; } +} diff --git a/modules/desktop/wm/niri/config/config.kdl b/modules/desktop/wm/niri/config/config.kdl new file mode 100644 index 0000000..73e351d --- /dev/null +++ b/modules/desktop/wm/niri/config/config.kdl @@ -0,0 +1,78 @@ +include "~/.config/niri-generated.kdl" +include "rules.kdl" +include "binds.kdl" + +input { + focus-follows-mouse max-scroll-amount="0%" + workspace-auto-back-and-forth +} + +layout { + gaps 23 + center-focused-column "on-overflow" + always-center-single-column + + focus-ring { + off + } + + border { + on + width 4 + inactive-color "#2e2e3eee" + active-gradient from="#6186d6ee" to="#cba6f7ee" angle=180 relative-to="workspace-view" + } + + insert-hint { + color "rgba(42, 44, 54, 0.5)" + } + + preset-column-widths { + proportion 0.33333 + proportion 0.4 + proportion 0.5 + proportion 0.6 + proportion 0.66667 + proportion 0.8 + } + + default-column-width { proportion 0.8; } + + background-color "transparent" + + tab-indicator { + width 10 + place-within-column + } +} + +prefer-no-csd + +hotkey-overlay { + skip-at-startup +} + +clipboard { + disable-primary +} + +blur { + passes 3 + offset 4 + noise 0.02 + saturation 1.5 +} + +overview { + workspace-shadow { + off + } +} + +animations { + on + slowdown 1.5 + workspace-switch { + spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 + } +} diff --git a/modules/desktop/wm/niri/config/rules.kdl b/modules/desktop/wm/niri/config/rules.kdl new file mode 100644 index 0000000..1bd277f --- /dev/null +++ b/modules/desktop/wm/niri/config/rules.kdl @@ -0,0 +1,38 @@ +layer-rule { + match namespace="^wallpaper$" + place-within-backdrop true +} + +window-rule { + draw-border-with-background false + geometry-corner-radius 14.000000 14.000000 14.000000 14.000000 + clip-to-geometry true + background-effect { + xray true + blur true + } +} + +window-rule { + match is-floating=true + background-effect { + xray false + } +} + +window-rule { + match app-id="kitty|foot|Alacritty|ghostty" + opacity 0.8 +} + +window-rule { + match app-id="org.gnome.Nautilus" + opacity 0.6 +} + +window-rule { + match app-id="org.jackhuang.hmcl.Launcher" + border { + off + } +} diff --git a/modules/desktop/wm/niri/default.nix b/modules/desktop/wm/niri/default.nix index c7c808b..c331db3 100644 --- a/modules/desktop/wm/niri/default.nix +++ b/modules/desktop/wm/niri/default.nix @@ -15,10 +15,11 @@ in }; config = lib.mkIf cfg.enable { - niri-flake.cache.enable = false; programs.niri = { enable = true; package = pkg; + # We manage xdg.portal ourselves below. + withXDG = false; }; services.displayManager = { ly = { @@ -32,7 +33,6 @@ in }; security.pam.services.login.enableGnomeKeyring = true; - services.gnome.gnome-keyring.enable = true; my.persist.homeDirs = [ { directory = ".local/share/keyrings"; @@ -57,8 +57,17 @@ in xdg-desktop-portal-gnome ]; }; - systemd.user.services.niri-flake-polkit.serviceConfig.ExecStart = - lib.mkForce "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + systemd.user.services.niri-polkit = { + description = "PolicyKit Authentication Agent"; + wantedBy = [ "niri.service" ]; + after = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + }; + }; services.system76-scheduler.enable = true; diff --git a/modules/i18n/fcitx5.nix b/modules/i18n/fcitx5.nix index 53f8256..58f7ac7 100644 --- a/modules/i18n/fcitx5.nix +++ b/modules/i18n/fcitx5.nix @@ -187,12 +187,12 @@ in ) ) ]; - my.hm.programs.niri.settings = { - binds."Mod+Space".action.spawn = [ + my.hm.wayland.windowManager.niri.settings = { + binds."Mod+Space".spawn = [ "fcitx5-remote" "-t" ]; - spawn-at-startup = [ { command = [ "fcitx5" ]; } ]; + spawn-at-startup = [ [ "fcitx5" ] ]; }; }; }