swaywm/swayidle

Feature Request: per-display/output idle handling

blitmap opened this issue · 6 comments

Hello,

A long, long while back in #wayland I brought up some ideas that it would be neat (if you're watching a movie) to have displays blank just on the displays that were idle. The output showing the movie would continue to stay on. At the moment, it seems idle detected in a session-wide way through from logind? You can only detect idle across everything or nothing.

I'm not sure how this should be handled, but I wish it were possible to do this. Could swayidle be extended to allow you to execute a command when an individual screen/output has become "idle"?

(Thanks!)

The idle protocol is missing output information, which is necessary for this feature.

I am most definitely in the wrong place to suggest this. There are several neat things to consider here:

  1. If we're talking about a login session or an output/display becoming idle.
  2. How we want displays to become idle (detection).
  3. What common behaviors a compositor might support.

Currently I think "idleness" is being detected login-session-wide? The compositor doesn't detect if individual outputs/displays have gone idle. How do outputs/displays go idle? Is this based on visual changes on the display - compositing? or is this something signaled by the application that has registered itself with the output/display?

The whole reason I brought this up is because traditionally all displays blank/dpms-off when a login session goes idle. It would be SO COOL, if you could instead just blank screens that aren't active. There are other things that would be neat to do: turning down the brightness of idle screens, or showing a fullscreen "idle" overlay with system information. This would/could be done with swayidle to invoke this other program. This is a stretch, but i could also see car infotainment systems that blank outputs that are marked as non-essential. Like you might blank a secondary display while driving but leave the main touchscreen on. Kinda outside the realm of a tiling window manager.

Do applications tell the compositor if they're idle? Would it be useful in any way to signal back to the application that the screen/output considers itself idle? I am circular.

Anywho. Appreciate the response. :)

The way it works is:

  • The compositor knows some applications inhibit idle. It means that if they are visible on an output, the output should stay on. This is done with the idle-inhibit protocol or via the sway configuration.
  • The idle protocol allows the compositor to tell swayidle if the user has been inactive for some time and if no idle inhibitors are visible (on any screen). When this happens, swayidle executes commands.

So we need to add output information to te idle protocol for swayidle (or other idle manager programs) to be able to DPMS individual outputs.

So now I can enumerate several things that would be pretty neat:

  1. If an idle-inhibiting client is present, do not blank all screens (traditional behavior).
  2. If an idle-inhibiting client is present, do not blank just the output it can be seen on (it may extend to another output).
  3. If an idle-inhibiting client is present, ignore it! I can't imagine it is common, but maybe you're playing a video that you don't care to keep the display active for if idleness is triggered

(and I think what you're saying is the idle protocol before this project needs to be extended)

@blitmap for case of watching a movie, you are probably always watching it on a bigger external monitor.

A global keyboard shortcut can be bound to toggle the laptop screen on and off. For example, for sway:

bindsym Mod4+Shift+m output eDP-1 toggle

A shell script

That way, you don't have to wait for the laptop screen to timeout five minutes into watching the movie-- you can turn it off immediately.

One use case I have for that:
I have a laptop with an oled screen that display my messages/mail apps, then my main screen with some terminals, web browser, and all.. basically, everything else.
As I want to save my oled screen from burning pixels, if I don't use this screen which happen 80% of the the time, I want it to turn off when I don't use it. currently using @markstos solution (with dpms toggle instead of toggle), but it can be nice if swayidle can handle it by itself