niri: use nix for config

This commit is contained in:
Veneficium 2025-08-09 19:13:48 +02:00
parent 71f9c13bb2
commit 5ff790870d

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
swayosd
@ -53,5 +53,182 @@
programs.fuzzel.enable = true;
services.wpaperd.enable = true;
programs.niri.config = builtins.readFile ./config.kdl;
# programs.niri.config = builtins.readFile ./config.kdl;
programs.niri.settings = {
prefer-no-csd = true;
spawn-at-startup = [
{ command = [ "wpaperd" ]; }
];
window-rules = [
{
geometry-corner-radius =
let
r = 8.0;
in
{
top-left = r;
top-right = r;
bottom-left = r;
bottom-right = r;
};
clip-to-geometry = true;
}
];
hotkey-overlay.skip-at-startup = true;
input = {
keyboard = {
xkb.layout = "it";
xkb.options = "caps:capslock";
track-layout = "global";
};
touchpad = {
natural-scroll = true;
scroll-method = "two-finger";
click-method = "button-areas";
};
mouse = {
accel-speed = -0.8;
};
focus-follows-mouse.enable = true;
focus-follows-mouse.max-scroll-amount = "5%";
};
layout = {
preset-column-widths = [
{ proportion = 1.0 / 3.0; }
{ proportion = 1.0 / 2.0; }
{ proportion = 2.0 / 3.0; }
];
default-column-width.proportion = 1.0 / 2.0;
focus-ring = {
active.color = "#8d4eef";
inactive.color = "#505050";
};
};
binds = with config.lib.niri.actions; {
"XF86AudioRaiseVolume" = {
action.spawn = [
"swayosd-client"
"--output-volume=raise"
];
allow-when-locked = true;
};
"XF86AudioLowerVolume" = {
action.spawn = [
"swayosd-client"
"--output-volume=lower"
];
allow-when-locked = true;
};
"XF86AudioMute" = {
action.spawn = [
"swayosd-client"
"--output-volume=mute-toggle"
];
allow-when-locked = true;
};
"XF86AudioMicMute" = {
action.spawn = [
"swayosd-client"
"--input-volume=mute-toggle"
];
allow-when-locked = true;
};
"XF86MonBrightnessUp" = {
action.spawn = [
"swayosd-client"
"--brightness=raise"
];
allow-when-locked = true;
};
"XF86MonBrightnessDown" = {
action.spawn = [
"swayosd-client"
"--brightness=lower"
];
allow-when-locked = true;
};
"XF86AudioPlay" = {
action.spawn = [
"playerctl"
"play-pause"
];
allow-when-locked = true;
};
"XF86AudioStop" = {
action.spawn = [
"playerctl"
"stop"
];
allow-when-locked = true;
};
"XF86AudioPrev" = {
action.spawn = [
"playerctl"
"previous"
];
allow-when-locked = true;
};
"XF86AudioNext" = {
action.spawn = [
"playerctl"
"next"
];
allow-when-locked = true;
};
"Mod+T".action.spawn = "ghostty";
"Mod+D".action.spawn = "fuzzel";
"Mod+Q".action = close-window;
"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+Left".action = focus-column-left;
"Mod+Right".action = focus-column-right;
"Mod+Up".action = focus-window-up;
"Mod+Down".action = focus-window-down;
"Mod+Page_Down".action = focus-workspace-down;
"Mod+Page_Up".action = focus-workspace-up;
"Mod+Ctrl+Page_Down".action = move-column-to-workspace-down;
"Mod+Ctrl+Page_Up".action = move-column-to-workspace-up;
"Mod+WheelScrollDown" = {
action = focus-workspace-down;
cooldown-ms = 150;
};
"Mod+WheelScrollUp" = {
action = focus-workspace-up;
cooldown-ms = 150;
};
"Mod+Ctrl+WheelScrollDown" = {
action = move-column-to-workspace-down;
cooldown-ms = 150;
};
"Mod+Ctrl+WheelScrollUp" = {
action = move-column-to-workspace-up;
cooldown-ms = 150;
};
"Mod+R".action = switch-preset-column-width;
"Mod+Shift+R".action = switch-preset-window-height;
"Mod+Ctrl+R".action = reset-window-height;
"Mod+F".action = maximize-column;
"Mod+Shift+F".action = fullscreen-window;
"Mod+C".action = center-column;
"Mod+V".action = toggle-window-floating;
"Print".action = screenshot;
};
};
}