LinuxCommandLibrary

copyq

Manage clipboard history with advanced features

TLDR

Launch CopyQ to store clipboard history

$ copyq
copy

Show current clipboard content
$ copyq clipboard
copy

Insert raw text into the clipboard history
$ copyq add -- [text1] [text2] [text3]
copy

Insert text containing escape sequences ('\n', '\t') into the clipboard history
$ copyq add [firstline\nsecondline]
copy

Print the content of the first 3 items in the clipboard history
$ copyq read 0 1 2
copy

Copy a file's contents into the clipboard
$ copyq copy < [path/to/file.txt]
copy

Copy a JPEG image into the clipboard
$ copyq copy image/jpeg < [path/to/image.jpg]
copy

SYNOPSIS

copyq [options] [command [arguments]]

Examples:
copyq show
copyq read 0
copyq write "Hello World"
copyq paste

PARAMETERS

--help
    Displays help information about the command-line usage.

--version
    Shows the version of CopyQ.

--start-server
    Starts the CopyQ daemon (background process) if it's not already running.

--stop-server
    Stops the running CopyQ daemon.

--toggle
    Toggles the visibility of the main CopyQ window.

--show
    Shows the main CopyQ window.

--hide
    Hides the main CopyQ window.

--menu
    Displays the context menu at the current mouse cursor position.

--paste [index]
    Pastes the item at the specified index (default 0, the latest) to the currently active application.

--selection [index]
    Copies the item at the specified index to the primary selection (X11).

--history
    Shows the history tab in the main window.

--read [index]
    Prints the content of the item at index (default 0) to standard output.

--write [text]
    Writes the specified text to the clipboard. Use - to read from stdin.

--remove [index]
    Removes the item at the specified index (default 0) from history.

--eval [script]
    Executes the given JavaScript script within the CopyQ environment.

--print [item_format]
    Prints specific data of the item at index 0 (e.g., 'text', 'image', 'html', 'all').

--config [key] [value]
    Reads or sets a configuration key. If value is omitted, prints the current setting.

--tabs
    Lists all available tab names.

--insert [tab_name] [index]
    Inserts a new tab with the specified tab_name at the given index.

--move [index] [new_index]
    Moves an item from its current index to a new_index within the history.

DESCRIPTION

CopyQ is a powerful, cross-platform clipboard manager with advanced features. It monitors the system clipboard and stores a history of all copied content, including text, images, HTML, and other data types. Users can easily browse, search, and manage this history through a customizable graphical interface or a comprehensive command-line interface.

Key functionalities include pasting previously copied items, editing clipboard contents, executing custom actions, and scripting for automation. CopyQ aims to enhance productivity by providing robust clipboard management capabilities beyond typical system clipboard functionality, allowing users to quickly access, manipulate, and reuse past clipboard entries.

CAVEATS

CopyQ relies on a background server process to function. Command-line operations will fail if the server is not running. On some Linux distributions or with containerized applications (e.g., Snap, Flatpak), direct clipboard access or interaction might be restricted due to security sandboxing, requiring specific permissions or workarounds. As a Qt-based GUI application, it has GUI library dependencies.

SERVER-CLIENT ARCHITECTURE

CopyQ operates with a server-client model. The main CopyQ application runs as a server daemon in the background, continuously monitoring the clipboard. All command-line interactions act as clients communicating with this running server, allowing for seamless integration into scripts and workflows without needing to open the GUI manually.

CUSTOMIZATION AND SCRIPTING

One of CopyQ's most powerful features is its extensive customization options. Users can create custom actions triggered by specific clipboard content, define keyboard shortcuts, and leverage a built-in JavaScript engine for advanced scripting. This allows for automation of complex tasks, such as automatically converting text formats, running external commands, or filtering content upon copy.

RICH DATA TYPE SUPPORT

Unlike simple clipboard tools, CopyQ can handle and store various data types beyond plain text. This includes images, HTML, rich text format (RTF), and custom MIME types. This capability is crucial for users who frequently copy complex content from web browsers, document editors, or image applications, ensuring that formatting and non-textual data are preserved in the history.

HISTORY

Developed by Lukas Sabat, CopyQ emerged as a versatile clipboard manager, initially targeting X11 environments but quickly expanding its reach to become a cross-platform solution for Linux, Windows, and macOS. Its development has focused on robust functionality, extensibility through scripting, and a user-friendly interface, making it a popular choice for power users seeking enhanced clipboard capabilities.

SEE ALSO

xclip(1), xsel(1), wl-copy(1), wl-paste(1)

Copied to clipboard