]> git.mdlowis.com Git - proto/labwc.git/commitdiff
rcxml: add core.autoEnableOutputs option
authorJohn Lindgren <john@jlindgren.net>
Fri, 27 Dec 2024 20:13:12 +0000 (15:13 -0500)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 31 Dec 2024 16:32:42 +0000 (16:32 +0000)
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
docs/rc.xml.all
include/config/rcxml.h
src/config/rcxml.c
src/output.c

index 95564083cf919d32ca14ea92aab46949a8ffcad4..4e41d57fb7911af60b85b7ae3eccac5b1cf16bfb 100644 (file)
@@ -171,6 +171,7 @@ this is for compatibility with Openbox.
   <gap>0</gap>
   <adaptiveSync>no</adaptiveSync>
   <allowTearing>no</allowTearing>
+  <autoEnableOutputs>yes</autoEnableOutputs>
   <reuseOutputMode>no</reuseOutputMode>
   <xwaylandPersistence>yes</xwaylandPersistence>
 </core>
@@ -209,6 +210,14 @@ this is for compatibility with Openbox.
        consider setting the environment variable WLR_DRM_NO_ATOMIC=1 when
        launching labwc.
 
+*<core><autoEnableOutputs>* [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.
+
 *<core><reuseOutputMode>* [yes|no]
        Try to re-use the existing output mode (resolution / refresh rate).
        This may prevent unnecessary screenblank delays when starting labwc
index a4f628bad7112ddda6bec2ffb6b5604ff9b821ce..ee7b111ef6fe15596ebc39def2b3a4f103525832 100644 (file)
@@ -12,6 +12,7 @@
     <gap>0</gap>
     <adaptiveSync>no</adaptiveSync>
     <allowTearing>no</allowTearing>
+    <autoEnableOutputs>yes</autoEnableOutputs>
     <reuseOutputMode>no</reuseOutputMode>
     <xwaylandPersistence>yes</xwaylandPersistence>
   </core>
index c65d648440c21876869c526adb5f2c9b2352652e..8475738615f182dfccc2e0590008c8d961fb5019 100644 (file)
@@ -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;
index cbb9eab692117cbaaa0a93236df631b9cb9eae41..f3f04db8e83b80363727480f19316cf3fccf2103 100644 (file)
@@ -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)
index a75f6e13a8c5810a7021942cbc28534265accb69..22105254055b845bc7461ff6894489736d4b2496 100644 (file)
@@ -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);
 }