From dc826fef81fbad86e71538691321fa9d39b083de Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Fri, 27 Dec 2024 15:13:12 -0500 Subject: [PATCH] rcxml: add core.autoEnableOutputs option Currently, labwc automatically enables outputs at startup and when new outputs are connected. Make this behavior optional (but still enabled by default). With autoEnableOutputs disabled, tools such as kanshi can be used to give finer-grained control of which outputs are enabled and when. --- docs/labwc-config.5.scd | 9 +++++++++ docs/rc.xml.all | 1 + include/config/rcxml.h | 1 + src/config/rcxml.c | 3 +++ src/output.c | 5 ++++- 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 95564083..4e41d57f 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -171,6 +171,7 @@ this is for compatibility with Openbox. 0 no no + yes no yes @@ -209,6 +210,14 @@ this is for compatibility with Openbox. consider setting the environment variable WLR_DRM_NO_ATOMIC=1 when launching labwc. +** [yes|no] + Automatically enable outputs at startup and when new outputs are + connected. Default is yes. + + Caution: Disabling this option will make the labwc session unusable + unless an external tool such as `wlr-randr` or `kanshi` is used to + manage outputs. + ** [yes|no] Try to re-use the existing output mode (resolution / refresh rate). This may prevent unnecessary screenblank delays when starting labwc diff --git a/docs/rc.xml.all b/docs/rc.xml.all index a4f628ba..ee7b111e 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -12,6 +12,7 @@ 0 no no + yes no yes diff --git a/include/config/rcxml.h b/include/config/rcxml.h index c65d6484..84757386 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -69,6 +69,7 @@ struct rcxml { int gap; enum adaptive_sync_mode adaptive_sync; enum tearing_mode allow_tearing; + bool auto_enable_outputs; bool reuse_output_mode; enum view_placement_policy placement_policy; bool xwayland_persistence; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index cbb9eab6..f3f04db8 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1082,6 +1082,8 @@ entry(xmlNode *node, char *nodename, char *content) set_adaptive_sync_mode(content, &rc.adaptive_sync); } else if (!strcasecmp(nodename, "allowTearing.core")) { set_tearing_mode(content, &rc.allow_tearing); + } else if (!strcasecmp(nodename, "autoEnableOutputs.core")) { + set_bool(content, &rc.auto_enable_outputs); } else if (!strcasecmp(nodename, "reuseOutputMode.core")) { set_bool(content, &rc.reuse_output_mode); } else if (!strcmp(nodename, "policy.placement")) { @@ -1467,6 +1469,7 @@ rcxml_init(void) rc.gap = 0; rc.adaptive_sync = LAB_ADAPTIVE_SYNC_DISABLED; rc.allow_tearing = false; + rc.auto_enable_outputs = true; rc.reuse_output_mode = false; #if LAB_WLR_VERSION_OLDER_THAN(0, 18, 2) diff --git a/src/output.c b/src/output.c index a75f6e13..22105254 100644 --- a/src/output.c +++ b/src/output.c @@ -499,7 +499,10 @@ new_output_notify(struct wl_listener *listener, void *data) wlr_scene_node_raise_to_top(&server->menu_tree->node); wlr_scene_node_raise_to_top(&output->session_lock_tree->node); - configure_new_output(server, output); + if (rc.auto_enable_outputs) { + configure_new_output(server, output); + } + do_output_layout_change(server); }