YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
4.14k stars 123 forks source link

Turn off monitors after inactivity #108

Open YaLTeR opened 10 months ago

YaLTeR commented 10 months ago

Can be solved together with #104 because the Smithay PR linked there implements an idle timer perfect for this case.

ThatOneCalculator commented 3 months ago

Now that it's implemented in smithay, can this be looked at again?

YaLTeR commented 3 months ago

The reason this stalled is because right after that Smithay PR was merged, I implemented the idle protocol in niri, which means you can use tools like swayidle to do this.

This issue is still open because doing it in niri will allow a nicer fade out animation, but it also needs some config design. Where to put the setting and how to call it? What else do we need, like running a command when the screens power off (swaylock for instance)?

ThatOneCalculator commented 3 months ago

My naïve thought would be something like this, and you could have as many of these as you want.

idle {
    timeout "300" // 300 seconds, could be "5m" instead 
    run-after { spawn "swaylockniri"; } // optional
}
YaLTeR commented 3 months ago

What about the power off monitors part? :p Idle is a general term to run a command after idle, not necessarily turn off monitors.

ThatOneCalculator commented 3 months ago

And that's why I shouldn't write GitHub comments right before going to bed 😆

ThatOneCalculator commented 3 months ago

Although this could work...


idle {
    timeout 300
    monitor-off // this could be omitted for a non-monitor-off idle tast
    run-after { spawn "swaylockniri"; }
}
YaLTeR commented 3 months ago

I would somewhat prefer a spelling that emphasizes the turning off monitors part, since generic idle functionality can be done with swayidle

ThatOneCalculator commented 3 months ago

Maybe it could be a part of output?

output "DP-1" {
    // Other monitor settings
    poweroff-timeout 300 // 300 seconds
}
YaLTeR commented 3 months ago

Nah, they all turn off at the same time.

zefr0x commented 2 weeks ago

I would somewhat prefer a spelling that emphasizes the turning off monitors part, since generic idle functionality can be done with swayidle

What about a generic output setting, where we don't specify any output name? There we can write some generic output options.

outputs {
    inactivity 300 {
        turn-off
        run-after { spawn "swaylock"; }
    }

    background-color "#000000"
}
YaLTeR commented 2 weeks ago

Hmm... Maybe, not sure