module Opal::Clipboard

Overview

Cross-platform system clipboard utility for terminal applications. Provides dual-layer clipboard copying:

  1. Terminal OSC 52 escape sequences for remote/SSH/multiplexed sessions.
  2. Native OS clipboard integration (Windows clip.exe, macOS pbcopy, Linux wl-copy/xclip).

Defined in:

opal/clipboard.cr

Class Method Summary

Class Method Detail

def self.copy(text : String, io : IO = STDOUT, use_native : Bool = true, use_osc52 : Bool = true) : Bool #

Copies text to the system clipboard. By default, both emits OSC 52 escape sequences to io and invokes the native OS clipboard utility.


[View source]
def self.paste : String | Nil #

Reads text from the host OS clipboard using platform-specific tools.


[View source]
def self.supported? : Bool #

Returns true if native OS clipboard tools or OSC 52 are available.


[View source]