nix-configs/modules/desktop/niri.nix
2025-03-23 16:15:06 +01:00

92 lines
2.2 KiB
Nix

{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.desktop.niri;
floatingAppids = [
"floating-alacritty"
"org.pulseaudio.pavucontrol"
"KeePassXC"
"org.gnome.NautilusPreviewer"
];
matchFloat = lib.concatStringsSep "\n" (
map (x: ''
window-rule {
match app-id="${x}"
open-floating true
open-focused true
}
'') floatingAppids
);
in
{
options.xyno.desktop.niri.enable = lib.mkEnableOption "enable the niri desktop with xynos config";
config = lib.mkIf cfg.enable {
xyno.desktop = {
waybar.enable = lib.mkDefault true;
mako.enable = lib.mkDefault true;
};
home-manager.users.${config.xyno.system.user.name} = lib.mkIf config.xyno.presets.home-manager.enable ({...}: {
xyno.dark-theme.enable = true;
});
# xdg.portal = {
# enable = true;
# wlr.enable = true;
# };
programs.niri.enable = true;
environment.etc."niri/config.kdl".text = ''
// xwayland
spawn-at-startup "${pkgs.xwayland-satellite}/bin/xwayland-satellite"
screenshot-path "~/Pictures/screenshots/screenshot-%Y-%m-%d %H-%M-%S.png"
// Indicate screencasted windows with red colors.
window-rule {
match is-window-cast-target=true
focus-ring {
active-color "#f38ba8"
inactive-color "#7d0d2d"
}
border {
inactive-color "#7d0d2d"
}
shadow {
color "#7d0d2d70"
}
tab-indicator {
active-color "#f38ba8"
inactive-color "#7d0d2d"
}
}
// Block out password managers from screencasts.
window-rule {
match app-id=r#"^org\.keepassxc\.KeePassXC$"#
match app-id=r#"^org\.gnome\.World\.Secrets$"#
block-out-from "screencast"
}
// Block out mako notifications from screencasts.
layer-rule {
match namespace="^notifications$"
block-out-from "screencast"
}
input {
workspace-auto-back-and-forth
focus-follows-mouse max-scroll-amount="10%"
touchpad {
tap
}
}
// autogenerated from here on
${matchFloat}
'';
};
}