AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.77k stars 2.23k forks source link

Support the primary clipboard buffer on Unix #11203

Open YohDeadfall opened 1 year ago

YohDeadfall commented 1 year ago

Is your feature request related to a problem? Please describe.

Unix systems have a few types of clipboard buffers: secondary, primary and clipboard. The last one is already supported by Avalonia since it's supported by all platforms. The primary buffer is filled with data on selection and can be pasted through the middle mouse button. That feature is widely supported, so it may be worth to implement it.

Describe the solution you'd like

It requires extending the existing abstraction of the clipboard by providing an enum argument which defaults to the clipboard. If the mode is not supported then null is returned. In addition to that there should be a mouse gesture.

Describe alternatives you've considered

Keep it as an external package.

maxkatz6 commented 1 year ago

Should be considered as part of https://github.com/AvaloniaUI/Avalonia/issues/11011

kekekeks commented 1 year ago

Note, that it has to set the clipboard text on every single text selection change. So we'll need to change the way we interact with the clipboard in our TextBox to avoid allocations.