Skip to content
ConsoleMonster
Class

ClipboardService

ConsoleMonster.Clipboard

Namespace
ConsoleMonster.Clipboard
Assembly
ConsoleMonster
Modifiers
sealed

Copies serialized output as Unicode clipboard text. Uses the Windows clipboard, macOS pbcopy, or Linux wl-copy/xclip without a runtime package dependency. SSH uses an explicitly supplied OSC 52 writer only.

Inheritance

  • object
  • ClipboardService

Constructors

public ClipboardService() #

Creates a service for the current operating system and desktop session.

Methods

public bool TryCopy(string text, out string? error, Action<string>? osc52 = null) #

Copies text, Markdown source or HTML source as text, returning a diagnostic instead of throwing for unavailable providers.

Parameters

text string required
The serialized document. It is passed through standard input, never through command arguments.
error string? required
Null on success; an actionable diagnostic on failure (without the copied content).
osc52 System.Action<string>? = null optional
Optional terminal writer for SSH sessions. Delivery is sent, not acknowledged by the terminal.

Returns

bool True only if the clipboard provider reports success.