Skip to content

clipboard #

Description

clipboard provides access to the platform's clipboard mechanism. You can use it to read from the system clipboard, and write to it from your applications.

Examples

import clipboard

fn main() {
    mut c := clipboard.new()
    println(c.get_text())
}

fn new #

fn new() &Clipboard

new returns a new Clipboard instance allocated on the heap. The Clipboard resources can be released with free()

fn new_primary #

fn new_primary() &Clipboard

new_primary returns a new X11 PRIMARY type Clipboard instance allocated on the heap. Please note: new_primary only works on X11 based systems.

fn (Clipboard) check_ownership #

fn (cb Clipboard) check_ownership() bool

check_ownership returns true if the Clipboard has the content ownership.

fn (Clipboard) clear_all #

fn (mut cb Clipboard) clear_all()

clear_all clears the clipboard.

fn (Clipboard) copy #

fn (mut cb Clipboard) copy(text string) bool

copy copies text into the clipboard.

fn (Clipboard) destroy #

fn (mut cb Clipboard) destroy()

destroy destroys the clipboard and frees its resources.

fn (Clipboard) is_available #

fn (cb &Clipboard) is_available() bool

is_available returns true if the clipboard is available for use.

fn (Clipboard) paste #

fn (mut cb Clipboard) paste() string

paste returns current entry as a string from the clipboard.