clipboard API for the autokey-qt application on X11

This class is invoked as the “clipboard” class in AutoKey scripts. For example, the “autokey.scripting.clipboard_qt.QtClipboard.fill_clipboard()” method documented below is called as “clipboard.fill_clipboard()” in an AutoKey script.

There are three different implementations of the “clipboard” class, one for Wayland environments, one for X11/Gtk, and one for X11/Qt. They all offer the exact same methods. This the Qt implementation.

class autokey.scripting.clipboard_qt.QtClipboard(app=None)[source]

Read/write access to the X selection and clipboard - QT version

fill_clipboard(contents)[source]

Copy text into the clipboard

Usage: clipboard.fill_clipboard(contents)

Parameters:

contents – string to be placed in the selection

fill_selection(contents)[source]

Copy text into the X selection

Usage: clipboard.fill_selection(contents)

Parameters:

contents – string to be placed in the selection

get_clipboard()[source]

Read text from the clipboard

Usage: clipboard.get_clipboard()

Returns:

text contents of the clipboard

Return type:

str, or bytearray on Python >= 3.13

get_selection()[source]

Read text from the X selection

Usage: clipboard.get_selection()

Returns:

text contents of the mouse selection

Return type:

str

sem

Qt semaphore object used for asynchronous method execution

set_clipboard_image(path)[source]

Set clipboard to image

Usage: clipboard.set_clipboard_image(path)

Parameters:

path – Path to image file

Raises:

OSError – If path does not exist

text

Used to temporarily store the value of the selection or clipboard