You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move the idle/lock pipeline off swayidle → native ext-idle-notify-v1 manager
Split off from #200 (keep-awake/caffeine). While speccing the logind-native caffeine toggle there, @annikahannig noted: "maybe we need to move away from swayidle :)" — this issue tracks that.
Why
Today the idle→dim→lock→suspend timeline lives entirely in swayidle (etc/swayidle/config):
timeout 240 'brightnessctl -s set 10%' resume 'brightnessctl -r' # dim
timeout 300 'loginctl lock-session' # lock
timeout 600 'systemctl suspend' # suspend
before-sleep 'loginctl lock-session' # relock on sleep
swayidle consumes ext-idle-notify-v1 from niri and is run as a user unit (etc/systemd/user/swayidle.service). Two problems this creates:
swayidle doesn't honor logind inhibitors. That's exactly why add keep awake (caffeine) in panel with the brightness slider #200's caffeine has to bridge by SIGSTOP-ing swayidle (crates/hytte-services/src/screensaver.rs:304-320) instead of just holding a logind inhibitor. The pause is a process-level halt hack the code itself calls out as fragile (screensaver.rs:20-29).
Ship a native in-process idle manager in hytte-services — already a deliberately-deferred idea (etc/swayidle/README.md:6, screensaver.rs:395 "shipping our own ext-idle-notify-v1 client. Deprioritised"). trollshell becomes the idle daemon:
A reactive service consuming ext-idle-notify-v1 from niri (the same protocol swayidle reads).
Runs the dim/lock/suspend timers in-process, in the standard hytte service pattern.
before-sleep relock moves to a logind PrepareForSleep signal handler (we already have the logind.rs Manager wrapper and screensaver::lock() → loginctl lock-session).
What it touches
New hytte-services idle module + a wayland-client/protocol binding for ext_idle_notifier_v1.
Retire etc/swayidle/ (config, unit, README) and the swayidle PID/SIGSTOP code in screensaver.rs.
The Nix module / etc/README.md (swayidle is currently a documented session dependency).
Open questions / risks
unsafe_code = "forbid" workspace-wide (except hytte-ecal). A wayland-client consumer is safe Rust, but if we need raw protocol glue, decide where the boundary sits (new FFI crate vs. a safe binding crate). Worth confirming a pure-safe path exists before committing.
Parity: swayidle's -w (wait for command completion) semantics, the dim-then-restore on resume, and not double-locking need faithful reproduction.
@annikahannig — is the goal full swayidle retirement (trollshell owns idle end-to-end), or just "honor logind inhibitors" while keeping swayidle for now? The former is this issue; the latter is already covered by #200's plan. Happy to break this into impl chunks once you confirm the appetite.
Move the idle/lock pipeline off swayidle → native
ext-idle-notify-v1managerSplit off from #200 (keep-awake/caffeine). While speccing the logind-native caffeine toggle there, @annikahannig noted: "maybe we need to move away from swayidle :)" — this issue tracks that.
Why
Today the idle→dim→lock→suspend timeline lives entirely in swayidle (
etc/swayidle/config):swayidle consumes
ext-idle-notify-v1from niri and is run as a user unit (etc/systemd/user/swayidle.service). Two problems this creates:crates/hytte-services/src/screensaver.rs:304-320) instead of just holding a logind inhibitor. The pause is a process-level halt hack the code itself calls out as fragile (screensaver.rs:20-29).Proposed direction
Ship a native in-process idle manager in
hytte-services— already a deliberately-deferred idea (etc/swayidle/README.md:6,screensaver.rs:395"shipping our ownext-idle-notify-v1client. Deprioritised"). trollshell becomes the idle daemon:ext-idle-notify-v1from niri (the same protocol swayidle reads).idleinhibitor (add keep awake (caffeine) in panel with the brightness slider #200's mechanism, plus Firefox/mpv) just works, and the SIGSTOP hack inscreensaver.rsretires entirely.before-sleeprelock moves to a logindPrepareForSleepsignal handler (we already have thelogind.rsManager wrapper andscreensaver::lock()→loginctl lock-session).What it touches
hytte-servicesidle module + awayland-client/protocol binding forext_idle_notifier_v1.etc/swayidle/(config, unit, README) and the swayidle PID/SIGSTOP code inscreensaver.rs.etc/session wiring (niri-session.target, kanshi README references swayidle —etc/kanshi/README.md:90).etc/README.md(swayidle is currently a documented session dependency).Open questions / risks
unsafe_code = "forbid"workspace-wide (excepthytte-ecal). Awayland-clientconsumer is safe Rust, but if we need raw protocol glue, decide where the boundary sits (new FFI crate vs. a safe binding crate). Worth confirming a pure-safe path exists before committing.-w(wait for command completion) semantics, the dim-then-restore on resume, and not double-locking need faithful reproduction.@annikahannig — is the goal full swayidle retirement (trollshell owns idle end-to-end), or just "honor logind inhibitors" while keeping swayidle for now? The former is this issue; the latter is already covered by #200's plan. Happy to break this into impl chunks once you confirm the appetite.