AgentSpace.Avalonia.PrimarySelection
0.1.5
dotnet add package AgentSpace.Avalonia.PrimarySelection --version 0.1.5
NuGet\Install-Package AgentSpace.Avalonia.PrimarySelection -Version 0.1.5
<PackageReference Include="AgentSpace.Avalonia.PrimarySelection" Version="0.1.5" />
<PackageVersion Include="AgentSpace.Avalonia.PrimarySelection" Version="0.1.5" />
<PackageReference Include="AgentSpace.Avalonia.PrimarySelection" />
paket add AgentSpace.Avalonia.PrimarySelection --version 0.1.5
#r "nuget: AgentSpace.Avalonia.PrimarySelection, 0.1.5"
#:package AgentSpace.Avalonia.PrimarySelection@0.1.5
#addin nuget:?package=AgentSpace.Avalonia.PrimarySelection&version=0.1.5
#tool nuget:?package=AgentSpace.Avalonia.PrimarySelection&version=0.1.5
AgentSpace.Avalonia.PrimarySelection
X11 PRIMARY-selection access for Avalonia apps: the "highlight to copy, middle-click to paste" buffer used on Unix desktops.
Avalonia's IClipboard covers the CLIPBOARD selection (Ctrl+C / Ctrl+V);
this package adds the PRIMARY selection via direct libX11 P/Invoke.
No subprocess, no reflection. On Windows, macOS, or any host without
X11 the API is a safe no-op.
dotnet add package AgentSpace.Avalonia.PrimarySelection
using AgentSpace.Avalonia.PrimarySelection;
// On middle-click in your text control
var text = await PrimarySelection.GetTextAsync();
if (text is not null) InsertAtCaret(text);
// When the user finishes a mouse selection
PrimarySelection.SetText(selectedText);
API
| Member | Description |
|---|---|
bool IsSupported |
True iff a libX11 connection is available. |
Task<string?> GetTextAsync(int timeoutMs = 200, CancellationToken) |
Read the PRIMARY selection. |
void SetText(string? text) |
Claim ownership and serve text to peers until ownership is taken away. |
void Clear() |
Release ownership if we hold it. |
How it works
- Read — opens its own X11 display connection, issues
XConvertSelectionforUTF8_STRING, polls briefly for theSelectionNotifyreply, reads the resulting property. Synchronous on a worker thread, typically <20 ms. - Write — starts a tiny daemon thread once, claims
XA_PRIMARYviaXSetSelectionOwner, servicesSelectionRequestevents from peers forever (or until another client takes ownership / the process exits). Supports the standard targets:TARGETS,TIMESTAMP,UTF8_STRING,STRING.
XWayland
Works through XWayland. Mutter / KWin / wlroots compositors bridge X11
PRIMARY ↔ wp_primary_selection_unstable_v1, so Wayland-native apps can
middle-click-paste your text and you can read theirs.
License
MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AgentSpace.Avalonia.PrimarySelection:
| Package | Downloads |
|---|---|
|
AgentSpace.Avalonia.XTerm
An Avalonia terminal control: real PTY, 24-bit truecolor rendering, full mouse reporting, blinking cursor, OSC title, bell, color schemes, transparent background, and middle-click PRIMARY paste. The VT/xterm parser ships as a separate package (AgentSpace.VtDotNet) referenced here as a dependency. |
GitHub repositories
This package is not used by any popular GitHub repositories.