niri icon indicating copy to clipboard operation
niri copied to clipboard

Turn off monitors after inactivity

Open YaLTeR opened this issue 2 years ago • 11 comments

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

YaLTeR avatar Jan 19 '24 06:01 YaLTeR

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

ThatOneCalculator avatar Aug 08 '24 02:08 ThatOneCalculator

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)?

YaLTeR avatar Aug 08 '24 05:08 YaLTeR

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
}

ThatOneCalculator avatar Aug 08 '24 05:08 ThatOneCalculator

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

YaLTeR avatar Aug 08 '24 05:08 YaLTeR

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

ThatOneCalculator avatar Aug 08 '24 14:08 ThatOneCalculator

Although this could work...

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

ThatOneCalculator avatar Aug 08 '24 15:08 ThatOneCalculator

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

YaLTeR avatar Aug 08 '24 15:08 YaLTeR

Maybe it could be a part of output?

output "DP-1" {
    // Other monitor settings
    poweroff-timeout 300 // 300 seconds
}

ThatOneCalculator avatar Aug 08 '24 15:08 ThatOneCalculator

Nah, they all turn off at the same time.

YaLTeR avatar Aug 08 '24 15:08 YaLTeR

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"
}

zefr0x avatar Nov 09 '24 11:11 zefr0x

Hmm... Maybe, not sure

YaLTeR avatar Nov 09 '24 12:11 YaLTeR