Lyo.Desktop 3.0.0

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

Lyo.Desktop

HotkeyChord parses a settings string such as Ctrl+Shift+W. GlobalHotkeys.Create grabs those chords on the X root window or with RegisterHotKey, so they fire while another window is focused. Bind replaces the whole set. An empty list releases every grab. Caps Lock and Num Lock do not change which chord matches. Call GlobalHotkeys.InitializeThreading before any other X11 use, including Avalonia startup. DesktopClipboard reads and writes text, and writes a PNG. DesktopWindows lists, finds, and raises top-level windows. DesktopInput moves the pointer, clicks, and sends keys. Linux uses X11 and XTest. Windows uses Win32. Wayland without DISPLAY can still use the clipboard tools. X11WindowPlace moves a mapped window when a plain configure would be dropped. DesktopConfig.File is the path of a JSON file under $XDG_CONFIG_HOME/lyo or %AppData%\Lyo.

Features

  • Chords. HotkeyChord.Parse accepts modifiers in any order. A single-letter key is stored in upper case. ToString writes Ctrl, Shift, Alt, then Meta.
  • Grab. IGlobalHotkeys.Bind replaces the grabbed chords. The same chord cannot appear twice. A chord another program already owns throws. The message is that the shortcut is already in use.
  • Clipboard. DesktopClipboard.SetTextAsync prefers wl-copy, then xclip, then xsel. Windows writes with clip.exe and reads with Win32. SetPngAsync offers image/png on Linux and a bitmap on Windows.
  • Windows. DesktopWindows.List returns top-level windows. Find matches a title substring and skips a blank title. Activate raises the window. An id of 0 throws.
  • Input. DesktopInput.Click moves, presses, and releases. Send types text or one chord. Modifiers go down first and come up last.
  • Place. X11WindowPlace.TryPlace sends _NET_MOVERESIZE_WINDOW. A width or height of 0 leaves that axis alone. HasTitleBar reads _NET_FRAME_EXTENTS.
  • Config. DesktopConfig.File("screenshot.json") is %AppData%\Lyo\screenshot.json on Windows. Elsewhere it is $XDG_CONFIG_HOME/lyo/screenshot.json, or ~/.config/lyo/screenshot.json when that variable is unset.

Examples

Parse a hotkey

var chord = HotkeyChord.Parse("Ctrl+Shift+W");
Console.WriteLine(chord);

Grab start and stop

GlobalHotkeys.InitializeThreading();
using var keys = GlobalHotkeys.Create();
keys.Bind([
    new(HotkeyChord.Parse("Ctrl+Shift+W"), Start),
    new(HotkeyChord.Parse("Ctrl+Shift+Q"), Stop)
]);

Copy text

await DesktopClipboard.SetTextAsync("hello");
var text = await DesktopClipboard.GetTextAsync();

Find and click

var editor = DesktopWindows.Find(DesktopWindows.List(), "Editor");
if (editor is not null)
{
    DesktopWindows.Activate(editor.Value.Id);
    DesktopInput.Click(editor.Value.Bounds.X + 8, editor.Value.Bounds.Y + 8);
}

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Exceptions (direct, lyo)
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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Lyo.Desktop:

Package Downloads
Lyo.Avalonia.Components

Shared Avalonia controls for Lyo desktop apps. Tool windows dock inside a window. A window can dock to a screen edge.

Lyo.FileManager

Desktop file manager session for a remote FileStorage API or a local disk store.

Lyo.Screenshot

Region screen capture for Linux and Windows, with still PNG, animated GIF, and scrolling receipt stitch.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 50 10/23/2026