Raxol.System.Clipboard (Raxol v0.3.0)

View Source

Provides consolidated access to the system clipboard across different operating systems.

Handles interactions with platform-specific clipboard utilities like pbcopy/pbpaste (macOS), xclip (Linux/X11), and clip/powershell Get-Clipboard (Windows).

Requires xclip to be installed on Linux systems using X11. Wayland clipboard access might require different utilities not currently handled.

Summary

Functions

Copies the given text to the system clipboard.

Retrieves text from the system clipboard.

Functions

copy(text)

@spec copy(String.t()) :: :ok | {:error, atom() | String.t()}

Copies the given text to the system clipboard.

paste()

@spec paste() :: {:ok, String.t()} | {:error, atom() | String.t()}

Retrieves text from the system clipboard.

Returns {:ok, text} on success, or {:error, reason} on failure. An empty clipboard is considered success and returns {:ok, ""}.