From 066f5a2a01743e97eb10385b01d5687ea03d0068 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 b3debf07..d26fe0a7 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 aa24838c..a290e1a4 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 dd237fa4..10cdc0d3 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -68,6 +68,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 b87505e5..c87e5a0e 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1083,6 +1083,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")) { @@ -1465,6 +1467,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 9384e720..b6f3657b 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); }