AgentSpace.Avalonia.PrimarySelection 0.1.5

This package has not been indexed yet. It will appear in search results and will be available for install/restore after indexing is complete.
dotnet add package AgentSpace.Avalonia.PrimarySelection --version 0.1.5
                    
NuGet\Install-Package AgentSpace.Avalonia.PrimarySelection -Version 0.1.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AgentSpace.Avalonia.PrimarySelection" Version="0.1.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AgentSpace.Avalonia.PrimarySelection" Version="0.1.5" />
                    
Directory.Packages.props
<PackageReference Include="AgentSpace.Avalonia.PrimarySelection" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AgentSpace.Avalonia.PrimarySelection --version 0.1.5
                    
#r "nuget: AgentSpace.Avalonia.PrimarySelection, 0.1.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AgentSpace.Avalonia.PrimarySelection@0.1.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AgentSpace.Avalonia.PrimarySelection&version=0.1.5
                    
Install as a Cake Addin
#tool nuget:?package=AgentSpace.Avalonia.PrimarySelection&version=0.1.5
                    
Install as a Cake Tool

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 XConvertSelection for UTF8_STRING, polls briefly for the SelectionNotify reply, reads the resulting property. Synchronous on a worker thread, typically <20 ms.
  • Write — starts a tiny daemon thread once, claims XA_PRIMARY via XSetSelectionOwner, services SelectionRequest events 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last Updated
0.1.5 0 5/18/2026
0.1.4 0 5/18/2026
0.1.2 0 5/18/2026
0.1.1 0 5/18/2026
0.0.1 24 5/17/2026