sway icon indicating copy to clipboard operation
sway copied to clipboard

Add primary_selection config option

Open t1lde opened this issue 2 years ago • 7 comments

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)

t1lde avatar Mar 17 '22 21:03 t1lde

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.

emersion avatar Mar 17 '22 22:03 emersion

@t1lde Thank you for your effort. I'm looking forward to get this feature in the next release.

ivan-volnov avatar Apr 09 '22 13:04 ivan-volnov

Sorry I haven't gotten back to this, will give it another go with your suggestions when I get some time

t1lde avatar May 23 '22 11:05 t1lde

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

ghost avatar Aug 06 '22 03:08 ghost

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.

emersion avatar Aug 08 '22 07:08 emersion

Yes, after that change is made. I don't know C but it seems like a quite simple change.

ghost avatar Aug 08 '22 19:08 ghost

Submitted https://github.com/t1lde/sway/pull/1 for @t1lde to merge into this PR.

AidanGG avatar Nov 25 '22 12:11 AidanGG

Superseded by https://github.com/swaywm/sway/pull/7312

emersion avatar Dec 05 '22 13:12 emersion