docs: move explanations into short module headers

Non-obvious context sits in a brief header at the top of a module, everything else uses single-line comments. niri binds use spawn-sh strings, so neon only overrides the command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 09:25:40 +02:00
co-authored by Claude Opus 5.5
parent 8d19be9527
commit 06b656477b
10 changed files with 88 additions and 207 deletions
+12 -40
View File
@@ -1,7 +1,11 @@
# Only renders ~/.config/niri/config.kdl; niri itself, its session and portals
# come from modules/nixos/niri.nix. Outputs and input devices that differ
# per machine live in hosts/<host>/niri.nix.
{ lib, osConfig, ... }:
let
# Mod+1..9 focus a workspace, Mod+Ctrl+1..9 move the column there.
# Mod+1..9 focus a workspace, Mod+Ctrl+1..9 move the column there
workspaceBinds = lib.mergeAttrsList (
map (n: {
"Mod+${toString n}".focus-workspace = n;
@@ -9,24 +13,18 @@ let
}) (lib.range 1 9)
);
# Shorthand for binds that only run spawn-sh while allowed on the lock screen.
# shell command that also works on the lock screen
lockedSh = cmd: {
_props.allow-when-locked = true;
spawn-sh = cmd;
};
in
{
# Niri config, rendered to ~/.config/niri/config.kdl by home-manager's built-in
# wayland.windowManager.niri module. The compositor itself, its session, systemd
# units and portals are provided by the NixOS module (modules/nixos/niri.nix), so
# this module only writes the config. Host-specific outputs and input devices
# live in hosts/<host>/niri.nix.
wayland.windowManager.niri = {
# only on hosts that run niri (see modules/nixos/niri.nix)
# only on hosts that run niri
enable = osConfig.programs.niri.enable;
# Use the system's niri so the config is validated against the running version.
# validate the config against the installed niri
package = osConfig.programs.niri.package;
systemd.enable = false;
portalPackage = null;
@@ -125,21 +123,11 @@ in
};
"Mod+D" = {
_props.hotkey-overlay-title = "Run an Application";
spawn = [
"noctalia"
"msg"
"panel-toggle"
"launcher"
];
spawn-sh = "noctalia msg panel-toggle launcher";
};
"Super+Alt+L" = {
_props.hotkey-overlay-title = "Lock the Screen";
spawn = [
"noctalia"
"msg"
"session"
"lock"
];
spawn-sh = "noctalia msg session lock";
};
# media keys (PipeWire / WirePlumber)
@@ -151,24 +139,8 @@ in
"XF86AudioStop" = lockedSh "playerctl stop";
"XF86AudioPrev" = lockedSh "playerctl previous";
"XF86AudioNext" = lockedSh "playerctl next";
"XF86MonBrightnessUp" = {
_props.allow-when-locked = true;
spawn = [
"brightnessctl"
"--class=backlight"
"set"
"+10%"
];
};
"XF86MonBrightnessDown" = {
_props.allow-when-locked = true;
spawn = [
"brightnessctl"
"--class=backlight"
"set"
"10%-"
];
};
"XF86MonBrightnessUp" = lockedSh "brightnessctl --class=backlight set +10%";
"XF86MonBrightnessDown" = lockedSh "brightnessctl --class=backlight set 10%-";
"Mod+O" = {
_props.repeat = false;