config: add <core><primarySelection>

...to enable/disable primary selection clipboard support. This only works
on launch.

The reason it is useful to be able to disable this is that some clients
(like browsers) support middle-button-click to start scrolling up/down.

With some clients can be disabled via

   gsettings set org.gnome.desktop.interface gtk-enable-primary-paste false

...but for others (like chromium and electron based programs) a compositor
setting is required.

Fixes: #2815
This commit is contained in:
Johan Malm 2025-06-13 20:08:52 +01:00 committed by Johan Malm
parent c63ba3c7fa
commit 145de91932
5 changed files with 15 additions and 1 deletions

View file

@ -177,6 +177,7 @@ this is for compatibility with Openbox.
<autoEnableOutputs>yes</autoEnableOutputs>
<reuseOutputMode>no</reuseOutputMode>
<xwaylandPersistence>no</xwaylandPersistence>
<primarySelection>yes</primarySelection>
</core>
```
@ -235,6 +236,12 @@ this is for compatibility with Openbox.
Note: changing this setting requires a restart of labwc.
*<core><primarySelection>* [yes|no]
Enable or disable the primary selection clipboard. May only be
configured at launch. This enables autoscroll (middle-click to scroll
up/down) in Chromium and electron based clients without inadvertantly
pasting the primary clipboard. Default is yes.
## PLACEMENT
```

View file

@ -15,6 +15,7 @@
<autoEnableOutputs>yes</autoEnableOutputs>
<reuseOutputMode>no</reuseOutputMode>
<xwaylandPersistence>no</xwaylandPersistence>
<primarySelection>yes</primarySelection>
</core>
<placement>

View file

@ -73,6 +73,7 @@ struct rcxml {
bool reuse_output_mode;
enum view_placement_policy placement_policy;
bool xwayland_persistence;
bool primary_selection;
int placement_cascade_offset_x;
int placement_cascade_offset_y;

View file

@ -1161,6 +1161,8 @@ entry(xmlNode *node, char *nodename, char *content, struct parser_state *state)
set_bool(content, &rc.reuse_output_mode);
} else if (!strcasecmp(nodename, "xwaylandPersistence.core")) {
set_bool(content, &rc.xwayland_persistence);
} else if (!strcasecmp(nodename, "primarySelection.core")) {
set_bool(content, &rc.primary_selection);
} else if (!strcmp(nodename, "policy.placement")) {
enum view_placement_policy policy = view_placement_parse(content);
if (policy != LAB_PLACE_INVALID) {
@ -1549,6 +1551,7 @@ rcxml_init(void)
rc.auto_enable_outputs = true;
rc.reuse_output_mode = false;
rc.xwayland_persistence = false;
rc.primary_selection = true;
init_font_defaults(&rc.font_activewindow);
init_font_defaults(&rc.font_inactivewindow);

View file

@ -632,7 +632,9 @@ server_init(struct server *server)
*
* https://wayfire.org/2020/08/04/Wayfire-0-5.html
*/
wlr_primary_selection_v1_device_manager_create(server->wl_display);
if (rc.primary_selection) {
wlr_primary_selection_v1_device_manager_create(server->wl_display);
}
server->input_method_manager = wlr_input_method_manager_v2_create(
server->wl_display);