output: don't auto-configure new outputs during powersave

After e.g. wlopm --off, some external outputs will appear to labwc to
disconnect and reconnect. (I have one HDMI monitor which does this
repeatedly every 10 seconds as it cycles through inputs.) Currently,
these outputs are immediately reconfigured and enabled when they
reconnect, after which point they remain on all night.

For a screensaver/powersave mode that actually works, we need to prevent
this. This change adds logic to not auto-configure new outputs once all
existing outputs are turned off.

Downsides as currently implemented are:

- once reconnected, outputs are logically "disabled", not just "off",
  and wlopm --on cannot re-enable them (wlr-randr or kanshi works).

- this doesn't prevent external clients like kanshi from re-enabling
  outputs immediately when they reconnect, so it's necessary to stop
  kanshi during powersave and restart it afterward.

In spite of the downsides, I've been running with these changes for a
couple weeks with good results.
This commit is contained in:
John Lindgren 2024-10-19 20:13:18 -04:00
parent 893a65d838
commit 8cc8758f11
2 changed files with 33 additions and 1 deletions

View file

@ -330,6 +330,7 @@ struct server {
* do_output_layout_change() must be called explicitly.
*/
int pending_output_layout_change;
bool all_outputs_off;
struct wl_listener renderer_lost;
@ -406,6 +407,7 @@ struct output {
bool leased;
bool gamma_lut_changed;
bool powered_off;
};
#undef LAB_NR_LAYERS