jinek.X11Clipboard.Fork 1.0.0

dotnet add package jinek.X11Clipboard.Fork --version 1.0.0
                    
NuGet\Install-Package jinek.X11Clipboard.Fork -Version 1.0.0
                    
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="jinek.X11Clipboard.Fork" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="jinek.X11Clipboard.Fork" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="jinek.X11Clipboard.Fork" />
                    
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 jinek.X11Clipboard.Fork --version 1.0.0
                    
#r "nuget: jinek.X11Clipboard.Fork, 1.0.0"
                    
#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 jinek.X11Clipboard.Fork@1.0.0
                    
#: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=jinek.X11Clipboard.Fork&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=jinek.X11Clipboard.Fork&version=1.0.0
                    
Install as a Cake Tool

Medo.X11Clipboard

X11Clipboard library is designed for applications that need to interact with the X11 clipboard system. This library provides essential functions for getting and setting UTF-8 text content for both X11's primary selection and clipboard. This makes it ideal for applications that require straightforward clipboard interactions without the overhead of more comprehensive libraries.

Features:

  • Supports both primary selection and clipboard GetText and SetText operations.
  • .NET 8 AOT support

Fork notice

This repository is a fork of the original Medo.X11Clipboard by Josip Medved. It is maintained by Evgeny Gorbovoy jinek@msn.com.

The changes in this fork were implemented by Junie with ChatGPT-5. The main goals of the fork are to improve CA1031 compliance and developer ergonomics.

You can find packaged library at NuGet.

Usage

To write and read X11 primary selection (aka, middle-click clipboard):

using System;
using jinek.X11;

X11Clipboard.Primary.SetText("My text.");
Console.WriteLine(X11Clipboard.Primary.GetText());

To write and read normal clipboard:

using System;
using jinek.X11;

X11Clipboard.Clipboard.SetText("My text.");
Console.WriteLine(X11Clipboard.Clipboard.GetText());

Exception handling (fork changes)

  • Constructors now throw exceptions instead of silently failing:

    • PlatformNotSupportedException on non-Linux platforms.
    • X11ClipboardException for X11/atom/window initialization failures.
  • A new UnhandledException event is raised when an exception occurs in the background X11 event loop. You can observe and optionally handle it:

using jinek.X11;

// Subscribe once at startup
X11Clipboard.Clipboard.UnhandledException += (sender, e) => {
    // Log the error
    Console.Error.WriteLine($"X11 loop error: {e.Exception}");

    // If you decide you handled it and want to prevent the thread from crashing:
    e.Handled = true; // omit or set to false to let the exception bubble up
};
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on jinek.X11Clipboard.Fork:

Package Downloads
Consolonia.PlatformSupport

This package provides platform support for adapting to consoles on Windows, Linux and MacOS environments when building Console applications using Consolonia

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 147 10/22/2025

CHANGELOG

[fork-1.0.0] (2025-10-21)

- Fork: CA1031 compliance and exception handling adjustments.
- Added X11ClipboardException and X11ClipboardLoopExceptionEventArgs; constructor throws precise exceptions.
- Introduced UnhandledException event; exceptions bubble if not handled unless e.Handled = true.
- Updated metadata (Authors, URLs, Description, Version) in multi-framework csproj.
- Added GitHub Actions workflow to pack and publish NuGet on push to main.

[1.0.0] (2024-07-21)

- Initial release release



[unreleased]: https://github.com/jinek/Medo.X11Clipboard
[1.0.0]: Medo.X11Clipboard/1.0.0
[fork-1.0.0]: jinek.X11Clipboard.Fork/1.0.0