Files
nix-config/home/linux/gui/base/hypridle/default.nix
T
Ryan Yin 001d180b22 feat(noctalia): upgrade to the native v5 shell
Noctalia v5 is the native C++/Wayland rewrite; the Quickshell-based v4 line (pkgs.noctalia-shell) is EOL and its JSON config is not migrated upstream.

- use the upstream home-manager programs.noctalia module (present at our pinned HM revision) instead of the hand-rolled package + symlink module: it installs pkgs.noctalia, validates config.toml at build time via checkConfig, and supports customPalettes; drop the v4 Qt/Qt6ct session setup
- replace the v4 settings.json/plugins.json with a minimal shared config.toml (font, Catppuccin shell palette, templates off, screenshot annotation, accessibility/bar scale, night light, wallpaper, location/weather); host-specific bits live in per-host files (shoukei's eDP-1 backlight in noctalia/host-shoukei.toml), which merge after config.toml. Application theming stays with catppuccin/nix
- treat config.toml as the single source of truth: do NOT persist ~/.local/state/noctalia and set setup_wizard_enabled = false, so UI tweaks are promoted back into the repo instead of accumulating in app-owned state
- port niri keybinds to 'noctalia msg ...', update spawn-at-startup and the backdrop layer namespace, fix the broken 'octalia-shell' media-previous bind, and replace the grim/slurp/satty screenshot stack with Noctalia's native region/fullscreen/annotate commands (drop the unused packages)
- drop the now-redundant swaybg and swaylock (Noctalia owns the wallpaper and lock screen, the latter authenticating against the PAM 'login' service) and its PAM entry; keep wlogout as an emergency fallback
- update hypridle's lock commands and the matching eval test
- refresh the noctalia docs
2026-09-19 15:07:54 +08:00

73 lines
2.4 KiB
Nix

{
config,
lib,
...
}:
let
cfg = config.modules.desktop.hypridle;
in
{
options.modules.desktop.hypridle = {
keyboardBacklightTimeout = lib.mkOption {
type = lib.types.int;
description = "Seconds of idle before turning off the keyboard backlight.";
};
screenOffTimeout = lib.mkOption {
type = lib.types.int;
description = "Seconds of idle before turning off the monitors (DPMS).";
};
lockTimeout = lib.mkOption {
type = lib.types.int;
description = "Seconds of idle before locking the screen.";
};
};
config = {
# Hyprland/niri idle daemon. Declared in Nix (instead of a raw
# hypridle.conf) so each host can tune the timeouts below.
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "noctalia msg session lock";
before_sleep_cmd = "noctalia msg session lock";
# niri already owns org.freedesktop.ScreenSaver and feeds its
# inhibitors into the compositor idle notifier, so hypridle must not
# try to claim the interface (it would log "already providing...").
ignore_dbus_inhibit = true;
};
listener = [
{
timeout = cfg.keyboardBacklightTimeout;
# brightnessctl --list / -d kbd_backlight
on-timeout = "brightnessctl --save --device=kbd_backlight set 0";
on-resume = "brightnessctl --restore --device=kbd_backlight";
}
{
timeout = cfg.screenOffTimeout;
ignore_inhibit = true;
# Some apps keep idle-inhibit active even when they are only sitting
# on a page, which can prevent screen-off forever. Ignore those
# inhibitors for screen-off, but skip while an MPRIS player reports
# active playback.
condition_cmd = "! playerctl -a status 2>/dev/null | grep -q '^Playing$'";
condition_retry = 30;
on-timeout = "niri msg action power-off-monitors";
on-resume = "niri msg action power-on-monitors";
}
{
timeout = cfg.lockTimeout;
ignore_inhibit = true;
# Skip while media is playing, same as screen-off above.
condition_cmd = "! playerctl -a status 2>/dev/null | grep -q '^Playing$'";
condition_retry = 30;
on-timeout = "noctalia msg session lock";
}
];
};
};
};
}