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.
This commit is contained in:
John Lindgren 2024-12-27 15:13:12 -05:00 committed by Johan Malm
parent 49eeee387b
commit dc826fef81
5 changed files with 18 additions and 1 deletions

View 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

View file

@ -12,6 +12,7 @@
<gap>0</gap>
<adaptiveSync>no</adaptiveSync>
<allowTearing>no</allowTearing>
<autoEnableOutputs>yes</autoEnableOutputs>
<reuseOutputMode>no</reuseOutputMode>
<xwaylandPersistence>yes</xwaylandPersistence>
</core>

View 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;

View 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)

View 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);
if (rc.auto_enable_outputs) {
configure_new_output(server, output);
}
do_output_layout_change(server);
}