]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: add <core><primarySelection>
authorJohan Malm <jgm323@gmail.com>
Fri, 13 Jun 2025 19:08:52 +0000 (20:08 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Fri, 13 Jun 2025 19:27:49 +0000 (20:27 +0100)
...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
docs/labwc-config.5.scd
docs/rc.xml.all
include/config/rcxml.h
src/config/rcxml.c
src/server.c

index 90276203adbb34700bfe1f65812c098387fbf1d4..28a319c26f0b90c32b15b0673fa4ed08870a1cb6 100644 (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
 
 ```
index 4d137f80544ae0eab1893a26bc2977fbe0fa3e4a..5ac26e5fc913491ca1731c7b34c880e81d96e36d 100644 (file)
@@ -15,6 +15,7 @@
     <autoEnableOutputs>yes</autoEnableOutputs>
     <reuseOutputMode>no</reuseOutputMode>
     <xwaylandPersistence>no</xwaylandPersistence>
+    <primarySelection>yes</primarySelection>
   </core>
 
   <placement>
index 23312f7943b99b07ed31f3c9373cede57d52e6a0..05f750980ad878f4e6bf1f72ce2260e89304ceee 100644 (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;
 
index 717ff311aeb8188f5bf9e99208b85ab214c2fc13..697f1f78db462fc6130112d1f56bbfbb7bfb1fb6 100644 (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);
index e7b0cbb8877de51b45b9b75342307c7e3a7ca890..554398b8e688b2769ada676c1fbff76c1c0d7d39 100644 (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);