niri icon indicating copy to clipboard operation
niri copied to clipboard

Add example to config describing how to power off monitors after locking

Open Hofer-Julian opened this issue 1 year ago • 3 comments

With the current default behavior, Mod + Alt + L opens swaylock, but doesn't power off monitors. The config should include a commented out example showing how to add the power-off after logging out.

Hofer-Julian avatar Dec 10 '24 17:12 Hofer-Julian

Oh, that's an interesting way to do it.

YaLTeR avatar Dec 11 '24 04:12 YaLTeR

I am also using swayidle in pretty much the same way. (Side note: I prefer the wlopm tool over compositor-specific commands like power-off-monitors. I'll hopefully have some time soon to add wlr-output-power-management-v1 to niri)

agausmann avatar Jan 14 '25 22:01 agausmann

I configured it like this, I guess this could be added to the example config?

Super+Alt+L hotkey-overlay-title="Lock the Screen: swaylock" { spawn-sh "niri msg action power-off-monitors ; swaylock";}

wzbfyb avatar Sep 23 '25 06:09 wzbfyb

Yeah, one can use niri's own ipc mechanism to turn monitors off. Buut, if niri supported wlr-output-power-managment-v1, one could do that in a compositor agnostic way

tomasciccola avatar Sep 24 '25 16:09 tomasciccola

sure, but I do not quite get why you need to do that in a compositor agnostic way while using a specific compositor. anyhow I think this example is good enough for the documentation and saves people from googling around.

wzbfyb avatar Sep 25 '25 04:09 wzbfyb

because that way, you can have scripts that don't depend on a compositor. You can play/try other compositors and a lot of stuff will just keep working. f.e. I have a script to focus an open window or launch an app (using fuzzel). Since I discover wlrctl, I replace the part of the script for the window selection from using niri msg to using wlrctl. In the end its just preference, but I like not depending on compositors IPCs mechanisms

tomasciccola avatar Sep 25 '25 13:09 tomasciccola