-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: config option to disable primary-selection (clipboard) protocol #4511
Comments
Why do you want to disable it? |
Because I don't like it (Richard Feynman's explanation may help) |
Then don't use it |
Ha ha! Brilliant! Ok, I'll take that as a "This is not going to be implemented". |
If you can give a sensible reason to allow users to disable it, then I'll reconsider. If the reason is just "I don't like it", then no. |
Ok, I'll try. (I'm not sure that I understand exactly what your criteria are for a "sensible reason", but I won't let that hold me back!) Firstly, I often select stuff to make it stand out on the screen, and I don't want "the system" to store that selection because I think that's a security vulnerability. For example, "Hey, Joe, what do you think about this really sensitive word on this page, yeah, I'll select it so that you can see which sensitive word I'm talking about. Shit - now that I've selected it to show it to you, the system has recorded that sensitive word in primary, dammit! But I don't want that sensitive word hanging around in primary, so now I need to select something else and then verify that the second selection has replaced the sensitive word. Arghhhh." Secondly (related to the first, but not the same), there's the higher "active threshold requirement" (I just made that up) of copying into the clipboard than there is to copy into primary. I don't want the "system" to remember things just because I selected them - I want to "have to" select and then do something before the system copies the selection. Lastly, there's the idea of having 2 independent buffers (primary and clipboard) which is a blessing to some, but has been a curse to me. Depending on what I'm doing, this is somewhere slightly beyond my cognitive threshold, so sometimes I forget what is in each and I end up pasting the wrong one, at which point I have been known to search google for the 8-random-character-string that is my login-password. Great. Does any of this sound suitable? |
This is not how it works. When you select something, nothing happens. When you middle-click, the data transfer begins.
Addressed by not using the feature. |
Ok, now I'm even more confused. If I:
then the text (that is no longer selected) is pasted. But you said "When you select something, nothing happens". If, when you select something nothing happens, how does the system know what to paste? |
@emersion I'd like this option as well. The main reason is that I use middle-click to scroll and end up pasting various things (sometimes sensitive) I have highlighted. I highlight text as I read or when I want to delete multiple lines. @jaimet This post is about X11, but should answer your question about when the data transfer occurs. The underlying system doesn't copy the selection to a buffer, instead the application itself remembers what was highlighted. If you close the application the selected text won't be available to paste anymore. |
Hey, I've just discovered:
This might help (me!)... |
@emersion wrote
I've just re-read this, and I've realised that I don't understand what it means. When you say "Don't use it", do you mean "Don't select" or do you mean "Don't middle-click" (or perhaps something else)? |
Don't middle-click. |
Sorry for the potential necro, but i'm also in favor of this. Currently using a laptop, and trying to setup gestures with libinput-gestures, but a swipe down with 3 fingers sometimes registers as a middle click, pasting my entire primary selection (which sometimes includes like 90% of my terminal because of a touch screen) into a terminal, IRC, etc. An option to disable this would both be relevant to an issue like mine, as well as allowing people that don't want it to turn it off. |
Also in favor of this. Using a touchpad, I sometimes mistakenly middle click when scrolling with two/three fingers. Same thing with a clickable scroll wheel - I sometimes mistakenly middle click when scrolling. Those middle clicks paste the clipboard, modifying textareas, or flooding the terminal, etc -- it can get frustrating. If there was a way to turn off the middle-click paste function in sway... |
Have you tried |
Yes, I've tried that, both as a sway config:
and even manually with
doesn't stop the middle clicks / pastes from happening (touchpad or mouse)
|
Also in favor of this. Things should be configurable. I've messed up my typed text and source code on my laptop several times due to this feature. BTW, middle mouse button insertion cannot be disabled in X.Org also and people are forced to use such terrible solutions to remove this interfering functionality: https://askubuntu.com/a/4644 Please reopen issue. That problem is exist and annoying. |
I also would like to see that config option. |
Write a patch and see what happens, if it doesn't get accepted keep it in a fork or submit it to another fork. |
There is a huge difference between upstreaming a patch to add a new feature or maintaining a fork. |
Correct, the latter is much easier. Sway is a very comprehensive compositor and I bet that there's many features some people want config options for. That's great, but it also means that for a patch to get accepted is has to be part of an entire framework (similar to the security config for example) to get accepted, and then individual config options may be built off that. Maintaining a fork (or even a single patch file) isn't that difficult, especially with a feature that's only found in 15 lines of code ( diff --git a/sway/input/seat.c b/sway/input/seat.c
index e16d747cf..96c928c0e 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -504,14 +504,6 @@ static void handle_request_set_selection(struct wl_listener *listener,
wlr_seat_set_selection(seat->wlr_seat, event->source, event->serial);
}
-static void handle_request_set_primary_selection(struct wl_listener *listener,
- void *data) {
- struct sway_seat *seat =
- wl_container_of(listener, seat, request_set_primary_selection);
- struct wlr_seat_request_set_primary_selection_event *event = data;
- wlr_seat_set_primary_selection(seat->wlr_seat, event->source, event->serial);
-}
-
static void collect_focus_iter(struct sway_node *node, void *data) {
struct sway_seat *seat = data;
struct sway_seat_node *seat_node = seat_node_from_node(seat, node);
@@ -584,11 +576,6 @@ struct sway_seat *seat_create(const char *seat_name) {
&seat->request_set_selection);
seat->request_set_selection.notify = handle_request_set_selection;
- wl_signal_add(&seat->wlr_seat->events.request_set_primary_selection,
- &seat->request_set_primary_selection);
- seat->request_set_primary_selection.notify =
- handle_request_set_primary_selection;
-
wl_list_init(&seat->keyboard_groups);
wl_list_init(&seat->keyboard_shortcuts_inhibitors); Works, but not tested extensively. |
@TheAvidDev: Thank you for your effort but without getting the feature upstream I am not interested. |
You said you are looking for a new compositor because this feature is missing?
It's because, as you said, this feature is too specific. The better solution is to compile a list of all "configurable" options like this and setup some larger framework.
No problem, I'm happy others may find it useful. |
I've yet to find an explanation of why users cannot just stop using middle-click. I don't find explanations like "Sway should be configurable" or "I hit it by accident" very compelling. |
@emersion Middle click in certain apps have functionality, such as in web browsers middle clicking a link opens the link in a new tab. This can lead to conflicts/race condition if also in a text field. Perhaps it would make more sense that copy and paste are commands that can be bound to any key combo with the default config having it bound to middle click. |
Well, maybe you are simply better than everyone else and/or lack a certain degree of empathy: One solution to please different people comes down to this:
😉 PS: Please do not take this personal, I am simply trying to help you understand and I will value your contributions to free software making my life better regardless of if you agree or not. Personally, I am fine with the explanation @TheAvidDev gave. |
I just want to reiterate my reason: I use a laptop with a pointing stick. To scroll, I need to hold down the middle click button and move the pointing stick. If I hold/press middle click with the intention of scrolling but then I don't end up moving the pointing stick at all (maybe I changed my mind about scrolling) it will paste. This is happens a few times a day for me. I don't have the option of not middle-clicking in this case. |
This worked for me, thank you. |
First of all, I am a new user to sway, thanks for working on this fantastic project. Regarding this request, I am also in favour of this.
Just letting you know, there's a class of devices like the ThinkPad TrackPoint Keyboard that relies on clicking the middle-key to scroll. However, quite unfortunately, without this middle-click copy-paste behaviour disabled, copy/paste happens whenever the user tries to begin scrolling. Meanwhile, the main reason I use a tiling window manager (and even more, Desktop Linux) is being able customize my GUI experience into my habit with which I can be less distracted and more productive. IMHO more options here isn't a terrible thing to have as long as there's sane default that works for most users. If any of us here comes up with a patch, would you please see merging that as an option? Thank you so much again for working on this fantastic project. |
|
For some time I've been considering accepting a patch to disable primary selection altogether. However I'm concerned about a few limitations:
This isn't unheard of: for instance, the |
I'd like to see something like this in too, I often edit real-time collaborative documents in which any changes are committed as soon as performed. Often I have text in my selection that is pasted whenever I middle-click a link in said document (to open in a new tab), I could attempt to just try and remember to never middle-click but that's not feasible. I am able to avoid for a long time but once in a while it happens and when that happens it's really high impact. I've used PS: I found a workaround on firefox setting |
In my case, I am using an external Lenovo Trackpoint Keyboard where you can scroll with the pointing stick while holding down the middle button (very handy if you don't have a mouse). However, it triggers the paste already while clicking the middle button in contrast to the laptop keyboard where a middle click is triggered only after releasing the button without having touched the point stick. Of course, the fault comes from Lenovo's side, but it might be that it is not possible for them to do it differently on an external keyboard. |
This Technically, if you really mash the mouse buttons you may be able to copy and paste something before it is cleared, but it works very well for me in practice. |
For what it's worth, I'd really like to be able to disable the middle click entirely. My touchpad is such that I hit the middle button all the time when I mean to hit the left button, and it's really annoying. The |
I would also like to be able to disable the middle click entirely, half of the time, my touchpad falsely registers left clicks as middle button. My right hand is screwed up so "not using it" is not an option for me, I DON'T want to use it but the darn thing keeps registering left clicks as middle clicks. I don't have this QoL problem with other WMs/DEs. |
I think you may be able to disable middle clicking with libinput through either the |
It's possible to disable using |
I know it can be done in X (xinput), however, to my understanding all libinput stuff is now handled by the compositor now. I've looked everywhere and I can't find a way to pass this configuration to Sway. |
I personally want to disable pasting on middle-click only, because:
As for my second point, when I press the middle button and then unpress it without moving the TrackPoint, it will trigger a paste paste event. Potential
|
As far as I know and please correct me if I'm wrong, libinput is in charge of trackpad/mouse configuration. For Xorg, this is done via xinput and 40-libinput.conf But for Wayland this is configured directly by the DE, WM, Compositor etc; As far as I know, the only way to change it would be for Sway to provide a configuration option. |
Thanks, @psheljorde! I hope @emersion will change his mind and let us disable this IMHO unnecessary shortcut, as we can paste using Ctrl+V or even Shift+Ins or one could create custom shortcut / key binding if they wish. And it provides bad UX for TrackPoint users for pasting while scrolling. |
In #4511 (comment) I said I wouldn't be against a patch for this, given we properly figure out all of the implications. |
Oh, sorry I missed that comment. Anyway, I personally:
Update: This comment above reminded me that I also use middle-click in web browsers and I would really miss it. I am frustrated when I need to use Ctrl+left-click on MS Windows where middle-click does not open the link in a new tab (it does nothing). But that said I could sacrify this in order to disable middle-click pasting. |
See: swaywm#4511 Adds a config option 'primary_selection', which explicitly enables/disables the primary selection clipboard. This is implemented as a config-option check in 'handle_request_set_primary_selection', which clears the primary selection if the option is set to 'disabled'.
This has been implemented in #7312 |
See: #4511 Adds a bool config option `primary_selection`, which explicitly enables/disables the primary selection clipboard. Defaults to enabled. This is implemented as a launch-only option which enables or disables the creation of the `zwp_primary_selection_device_manager_v1` global. Co-authored-by: Tilde Rose <t1lde@protonmail.com>
See: swaywm#4511 Adds a bool config option `primary_selection`, which explicitly enables/disables the primary selection clipboard. Defaults to enabled. This is implemented as a launch-only option which enables or disables the creation of the `zwp_primary_selection_device_manager_v1` global. Co-authored-by: Tilde Rose <t1lde@protonmail.com>
Unfortunately, it does not work as intended/expected. Whenever I select any text and then press the middle button, the text is inserted. I tested this with the latest version ( Note that until this feature was implemented, I used Note that it works in (all apps are running in Wayland, exceptions are noted):
but does not work in:
Is there any way I can provide some logs or anything in order to fix this please? In Sway log (console output with |
Could be due to |
More issues:
The only thing that actually works is I tested this on IMHO, this issue should be reopened, as #7312 does not fix this issue. |
Because you might have a token in your clipboard and you accidentally paste it will trying to left or right click. |
I was becoming quite annoyed by this, so I decided to look into it. Seems like the |
Feature request: I'd love some config option that would completely disable the primary-selection protocol message proxying that sway does. I've just asked on IRC if anything like this already exists, and Kenny Levinson kindly informed me that this isn't configurable at the moment, hence this feature request.
If you need any more info, please let me know. TIA, J
PS I've just found https://wiki.gnome.org/Initiatives/Wayland/PrimarySelection which says "Constraints for a Wayland primary selection: We should address the security concerns by making sure that the feature is off by default and has to be enabled by the user". I appreciate that it's a different DE, but the point is interesting nonetheless.
The text was updated successfully, but these errors were encountered: