From d1fb8dcc5a15840d006c86e6efd8e336311d26b9 Mon Sep 17 00:00:00 2001 From: Myned Date: Sat, 28 Dec 2024 13:30:52 -0500 Subject: [PATCH] niri: switch to floating pr Signed-off-by: Myned --- flake.in.nix | 5 +++-- flake.nix | 4 ++++ options/custom/default.nix | 1 + options/custom/desktops/niri/binds.nix | 2 ++ options/custom/desktops/niri/default.nix | 27 +++++++++++++++++++++--- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/flake.in.nix b/flake.in.nix index c93c3ea..87f7c2d 100644 --- a/flake.in.nix +++ b/flake.in.nix @@ -57,7 +57,8 @@ hyprpaper = flake "github:hyprwm/hyprpaper" // unstable "nixpkgs"; hyprpicker = flake "github:hyprwm/hyprpicker" // unstable "nixpkgs"; jovian-nixos = flake "github:Jovian-Experiments/Jovian-NixOS" // unstable "nixpkgs"; - niri = flake "github:sodiboo/niri-flake" // unstable "nixpkgs"; + niri = flake "github:YaLTeR/niri/floating" // unstable "nixpkgs"; + niri-flake = flake "github:sodiboo/niri-flake" // unstable "nixpkgs"; nix-flatpak = flake "github:gmodena/nix-flatpak?ref=v0.5.1"; nix-index-database-unstable = flake "github:nix-community/nix-index-database" // unstable "nixpkgs"; nix-vscode-extensions = flake "github:nix-community/nix-vscode-extensions" // unstable "nixpkgs"; @@ -119,7 +120,7 @@ inputs.arion.nixosModules.arion inputs.disko.nixosModules.disko inputs.fw-fanctrl.nixosModules.default - inputs.niri.nixosModules.niri + inputs.niri-flake.nixosModules.niri inputs.stylix.nixosModules.stylix ]; diff --git a/flake.nix b/flake.nix index c62babf..2323023 100644 --- a/flake.nix +++ b/flake.nix @@ -96,6 +96,10 @@ url = "github:Rawa/lifx-cli"; }; niri = { + inputs.nixpkgs.follows = "nixpkgs-unstable"; + url = "github:YaLTeR/niri/floating"; + }; + niri-flake = { inputs.nixpkgs.follows = "nixpkgs-unstable"; url = "github:sodiboo/niri-flake"; }; diff --git a/options/custom/default.nix b/options/custom/default.nix index c5edf4e..f717816 100644 --- a/options/custom/default.nix +++ b/options/custom/default.nix @@ -39,6 +39,7 @@ in { wallpaper = mkOption {default = false;}; browser = { + # TODO: Use lib.getExe' instead of /bin/ everywhere # HACK: Find first matching package in final home-manager list command = mkOption { default = "${lib.findFirst (pkg: diff --git a/options/custom/desktops/niri/binds.nix b/options/custom/desktops/niri/binds.nix index d400a19..76e3694 100644 --- a/options/custom/desktops/niri/binds.nix +++ b/options/custom/desktops/niri/binds.nix @@ -113,6 +113,7 @@ in { (key "E" "Ctrl+Alt" (spawn [pkill "codium"])) (key "E" "Mod" (spawn codium)) (key "Equal" "Mod" (spawn [swayosd-client "--output-volume" "raise"])) + (key "Escape" "Mod" toggle-window-floating) (key "Escape" "Mod+Alt" (spawn ["lifx" "state" "--color" "red"])) (key "F" "Mod" (spawn [nautilus "--new-window"])) (key "G" "Ctrl+Alt" (spawn [pkill "steam"])) @@ -145,6 +146,7 @@ in { (key "Space" "Ctrl+Alt" (spawn ["lifx" "toggle"])) (key "T" "Ctrl+Alt" (spawn [pkill "kitty"])) (key "T" "Mod" (spawn kitty)) + (key "Tab" "Mod" switch-focus-between-floating-and-tiling) (key "Up" "Mod" (spawn [swayosd-client "--brightness" "raise"])) (key "V" "Mod" (spawn virt-manager)) (key "V" "Mod+Ctrl" (spawn vm)) diff --git a/options/custom/desktops/niri/default.nix b/options/custom/desktops/niri/default.nix index c58ad76..bcf173a 100644 --- a/options/custom/desktops/niri/default.nix +++ b/options/custom/desktops/niri/default.nix @@ -7,6 +7,9 @@ }: with lib; let cfg = config.custom.desktops.niri; + + # TODO: Use let bindings for hm config everywhere + hm = config.home-manager.users.${config.custom.username}; in { options.custom.desktops.niri = { enable = mkOption {default = false;}; @@ -35,10 +38,11 @@ in { # https://github.com/sodiboo/niri-flake/blob/main/docs.md programs.niri = { enable = true; - package = pkgs.niri; # nixpkgs + #// package = pkgs.niri; # nixpkgs + package = inputs.niri.packages.${pkgs.system}.default; }; - nixpkgs.overlays = [inputs.niri.overlays.niri]; + nixpkgs.overlays = [inputs.niri-flake.overlays.niri]; #!! Disabled bundled KDE polkit agent # https://github.com/sodiboo/niri-flake?tab=readme-ov-file#additional-notes @@ -48,7 +52,24 @@ in { custom.services.xwayland-satellite.enable = cfg.xwayland; home-manager.users.${config.custom.username} = { - programs.niri.package = config.programs.niri.package; + programs.niri = { + package = config.programs.niri.package; + + # https://github.com/YaLTeR/niri/wiki/Configuration:-Overview + # HACK: Prepend validated kdl config not currently implemented in settings module for e.g. custom build + # https://github.com/sodiboo/niri-flake/blob/main/settings.nix + config = with inputs.niri-flake.lib; + (internal.settings-module {config = hm;}).options.programs.niri.config.default + # https://github.com/sodiboo/niri-flake/blob/main/default-config.kdl.nix + ++ (with kdl; [ + # TODO: Migrate to niri.settings when released + # https://github.com/YaLTeR/niri/pull/871 + (plain "window-rule" [ + (leaf "match" {title = "^Picture.in.[Pp]icture$";}) + (leaf "open-floating" true) + ]) + ]); + }; }; }; }