sway
sway copied to clipboard
Add primary_selection config option
See: https://github.com/swaywm/sway/issues/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'.
Effect of Changes
With 'primary_config = enabled' in the config, the primary selection clipboard will not be filled.
A Consideration
After setting the option with the cli: sway primary_selection disabled
, there may still be a selection in the clipboard until the selection is cleared later. This could be addressed by clearing the clipboard after the option is set, but I'm not sure if that kind of effect would be desirable in the command function.
Alternatives
- Existing workarounds suggested in the linked issue
- A better & more flexible config option that can instead disable the middle-mouse paste action, while retaining the other functionality of middle_emulation. It seems like this would require some deeper changes to wlr, or lipinput, so I didn't pursue this yet (but would be willing to, perhaps with some guidance)
It would be better to not create the zwp_primary_selection_device_manager_v1
global if primary selection is disabled. This would let clients know that primary selection is disabled, instead of silently dropping the requests.
@t1lde Thank you for your effort. I'm looking forward to get this feature in the next release.
Sorry I haven't gotten back to this, will give it another go with your suggestions when I get some time
Please get this merged, I cannot count the number of times I have accidentally pasted stuff that I didn't even mean to copy while scrolling around in VSCode.
I have read #4511 and have tried the workarounds, but they either don't work or are still not a permanent solution.
The code is already written, it just needs to be tested and merged.
Thanks
The code is already written, it just needs to be tested and merged.
This code is not ready to be merged, see the comments above.
Yes, after that change is made. I don't know C but it seems like a quite simple change.
Submitted https://github.com/t1lde/sway/pull/1 for @t1lde to merge into this PR.
Superseded by https://github.com/swaywm/sway/pull/7312