Skip to content

hluk/copyq-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Useful commands for CopyQ clipboard manager.

You can share your commands and ideas here. Just open pull request or an issue.

For the list of commands see Commands section below.

Add a Command to CopyQ

To add a command to CopyQ:

  • copy the command code (starts with [Command] or [Commands] for multiple commands),
  • open CopyQ,
  • open Command dialog (F6 shortcut),
  • click "Paste Commands" button (or Ctrl+V),
  • apply changes.

To simplify this add command which shows notification with button to import all commands copied to clipboard. This also works if you just copy a link with commands.

Select Category Copy Command Link Import Command Notification

Write new Commands

See following documentation about writing commands and scripting.

Submit new pull request in this repository if you want to share a command.

Commands

Automatically preview images and long-text, and support manual preview with Space key. You can set the number of lines and characters for long text.

// More than 100 characters and 2 lines are considered as long text
var LongTextCharacters = 100
var LongTextLines = 2

Backs up items and configuration on exit.

Automatically moves larger amount of data copied to clipboard to a special tab (see the command variables to set the output tab and size limit) to keep the access to primary clipboard tab swift.

Blocklists clipboard text to omit adding it in item list and avoid running automatic commands on it.

Only checksum of the text (salted) is stored in the blocklist so this can be safely used with passwords (the texts are not stored anywhere).

Allows you to set a mark on an item, then later restore that mark to the clipboard.

The implementation uses special tags with a "mark:" prefix, and when a mark is set, removes that tag from any items that contain that tag.

E.g. changes "Do androids dream of electric sheep?" to "Do Androids Dream of Electric Sheep?".

Toggles between upper- and lower-case letters in selected text.

Clears clipboard after an interval (30 seconds by default).

Remove all items from clipboard tab using menu item (or custom shortcut).

Persistently displays notification with clipboard (and X11 selection) content.

Converts text written in Markdown syntax to desired format, which can be for example:

  • HTML
  • Jira markup
  • JSON (AST) (JSON representation of the parsed text; useful rather for contributors than users)
  • LaTeX

The command can be run on any text selection via a global shortcut or over items selected in the main window.

Installation

This script relies on the mistletoe project to do the actual Markdown parsing and conversion. This in turn requires that Python is installed on the user computer.

See mistletoe's page linked above for the various possibilities of its installation.

For output format "HTML + code highlighting", an additional Python package needs to be installed:

pip3 install pygments

Automatically adds new clipboard to tab with same name as title of the window where copy operation was performed.

Takes screenshot of selected part of the screen and tries to recognize text.

Requires GraphicsMagick and Tesseract.

Copies (Ctrl+C) from current window without storing or showing the data in GUI.

If any keyboard modifier (Ctrl, Shift, Alt etc) is held for a second after copying a content, it will not be stored or shown in GUI.

Allows to easily share items in readable text format.

Copies currently selected text and opens selection menu to search the text on some well-known websites. New search queries can be easily defined.

Pops up the main window (if the shortcut is pressed once), cycles through items (if the shortcut is pressed again) and pastes selected item when the shortcut is released.

See: hluk/CopyQ#1948

Like Cycle Items command but previews items to copy in popups without showing the main window.

Safely types in decrypted text of selected item instead of using clipboard.

Requires "xdotool" utility which works only on Linux/X11.

Compares two clipboard history items with your preferred diff tool.

The latest two items get compared when the command is run as a global command. You can also run the command on any two items selected in the main window.

By default, this command launches Beyond Compare 4 for doing the comparison. You can find examples of launching other tools like WinMerge directly in the command's source code.

Disables clipboard monitoring permanently, i.e. the state is restored when clipboard changes even after application is restarted.

Opens files referenced by selected item in external editor (uses "External editor command" from "History" config tab).

Works with following path formats (some editors may not support all of these).

  • C:/...
  • file://...
  • ~... (some shells)
  • %...%... (Windows environment variables)
  • $... (environment variables)
  • /c/... (gitbash)

Replace an existing tag with another (with a custom text).

Following command allows to edit current clipboard text before pasting it.

If the editing is canceled the text won't be pasted.

Add a filter menu to quickly filter images, URLs, files, etc.

You can customize the filters:

var filter1= {
    [mimeText]: 'File  ---------------- F',    //Text displayed on the menu
    [mimeIcon]: '',
    filter: '(?=^file://)',    //Regular expression of the filter
    shortcut: 'f'    //You need to set the menu shortcut of this command at the same time.
}

var filters = [filter1, filter2, filter3, ...]    //Add filters to the list

Shows full clipboard text in window title and tray tooltip.

Hides (or shows if hidden) item content except notes and tags.

Highlights syntax for recognized code.

Requires Python and Pygments.

Highlights all occurrences of a text (change x = "text" to match something else than text).

This is useful for ignoring cells copied as images from Microsoft Excel and LibreOffice Calc.

Linux/X11 only. Some web or other applications can automatically set X11 mouse selection buffer. This can be quiet annoying so this command tries to reset the buffer to previous content when this happens.

Ignore the clipboard if it contains a password or token based on the text characteristics (length, uppercase letters, digits).

Automatically store images copied to clipboard in a separate tab.

Shows notification allowing to easily import commands just copied to clipboard.

The copied text can be either link to a command on github or starts with [Command] or [Commands].

Indicates a copy operation by changing the icon tag.

Creates new item containing concatenated text of selected items.

Change the separator variable to separate the merged items with a different string than line break \n.

A plugin that prevents saving data from the KeePassXC password manager.

Keeps the first item (can be pinned) in clipboard at start and after a copy operation (after custom interval).

Creates interactive link from plain text.

Make the selected tab a clipboard tab and put the first item on the clipboard.

Toggles highlighting of selected items.

Enables Alt+1 .. Alt+9, Alt+0 to navigate to the tab based on the order (instead of the default Ctrl+Number navigation).

Remaps Up/Down arrows for browsing items to Ctrl+P/Ctrl+N or other custom shortcuts.

Stop showing current clipboard content in window title and tray tool tip.

Copies current date/time text to clipboard and pastes to current window on global shortcut Win+Alt+T.

Copies current date/time in ISO8601 format to clipboard, adds it to the clipboard history, and then pastes it to the current window.

Pastes selected Json text as a formatted Json text. If not Json, just pastes the text as is.

Paste items 1-9 in history using ctrl+1 through ctrl+9 shortcuts.

Pastes selected items and clear clipboard.

Generates a new RFC4122 version 4 compliant UUID, adds it to the clipboard history, copies it to the clipboard and pastes it to the current window. Full credit for UUID generation code goes to Jeff Ward (jcward.com), link: https://stackoverflow.com/a/21963136/11820711

Following command will play an audio file whenever something is copied clipboard.

Requires mpv utility.

Following command will play an audio file whenever something is copied clipboard.

Shows images instead of just a path (works with file://...).

A global shortcut to copy selected text/HTML/image as a new top item in "Stack" tab and another shortcut to paste the top item and remove it from the tab.

See: hluk/CopyQ#597

From currently selected text items, creates a new item with the QR code for the text.

Requires qrcode utility.

Saves an item as file to a preset path using available tags as it's file name, without overwriting. There is no user input dialog. This works great along the script show window title which saves source window title to tags while adding to clipboard. After installation, you must edit default folder (xyz) path: currentPath('C:/abc/xyz')

Other options: Number of words to use from tags (not number of tags): var words = 3 Default file name if there are no tags: var defaultname = 'clip'

Quickly pops up notification with text in clipboard using Win+Alt+C system shortcut.

Normally, if "Clipboard Storing" is disabled from File menu, it will be re-enabled automatically on the application start next time.

This command makes the last set state persistent between application launches.

Removes background and text colors from rich text (e.g. text copied from web pages).

Command can be both automatically applied on text copied to clipboard and invoked from menu (or using custom shortcut).

Removes carriage return, line feed and multiple space in the clipboard, then paste it.

Useful when copy texts from PDF.

Converts text item with HTML code to HTML item.

Renders markdown if recognized.

Requires marked.

Resets last clipboard text (or X11 selection) if it's cleared.

Opens dialog for saving selected item data to a file.

Take screenshot of the screen.

Take screenshot of selected part of the screen.

Search and replace specified text in the currently selected items or all items in the current tab.

Searches an text in all tabs and stores found items in "Search" tab.

Overrides main window shortcuts Ctrl+1..9 to quickly select items in specific row.

Quick shortcuts to activate items 0 to 9 (copy, move to top and paste depending on preferences in History configuration tab).

Shows Unicode code info for the first characters of any text. An example of how this looks like:

Show Character Code Dialog

Shows notification with current clipboard content (text or image).

Shows source application window title for new items in tag.

Requires "Tags" plugin.

Show main window after application starts.

Shows dialog with snippets to paste.

Snippets are loaded from "Snippets" tab. Item notes are used as snippet name.

Items can contain placeholders like:

  • ${Name} (default text is empty),
  • ${Name:value} (default text is "value"),
  • ${Name:value1,value2,value3} (default text is "value1"; allows to select from multiple values),
  • ${Name:\n} (multi-line text field).

When such snippet is selected, user is prompted to replace these placeholders with custom content.

To create your first snippet:

  1. create "Snippets" tab (Ctrl+T),

  2. add new item (Ctrl+N) with a snippet:

    You picked ${Fruit:apples,oranges,pears}!

  3. set optional snippet name (Ctrl+F2), e.g. "Fruit".

Triggering the Snippets command (with a global shortcut) will show a simple dialog where you can pick the snippet by its name.

To pick different tab name, you have to change the command's code.

var snippetsTabName = '&Snippets'

Sort items based on copy time, size, pinned status, etc.

  • When selecting single item, sort the entire tab
  • When selecting multiple items, only sort the selected items

Sorts tabs by name.

Restarts stopwatch and copies elapsed time since last started.

Store the copy time of new items in a tag.

To show tags in the item list the Tags plugin is required.

Optionally you can change the appearance of the copy time tag. See this example:

Tag Name: \1

Match: (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})

Style Sheet: font-size: 9pt; color: #fff; border: 1px solid #000; background: #000; padding: 0 2px

Stores Linux/X11 mouse selections in a separate tab.

Synchronizes clipboard with other application session running on different X11 servers.

Use Tab and Shift+Tab to select next/previous item.

Use a shortcut or a toolbar action to quickly find a tab and focus it on Enter key or double click.

This uses a separate CopyQ session/app-instance to show the tab list.

Two commands to add frequent items to special tab and to show frequent items with global shortcut.

For copied URLS tries to get web page title and icon and stores it with item in "url" tab.

Global shortcuts to select tabs. It is possible to select the Nth tab by order and the next or previous tab.

Toggles clipboard storing/monitoring with global shortcut or from menu/toolbar.

Display command combined with a shortcut that changes how selected items are displayed: as plain text or rich text (HTML).

Show/hide more compact items (one line of text or thumbnail).

Instead of two commands, one to tag and other to untag selected items, and see two actions in toolbar, you can use this command to toggle a tag.

Whenever a new top item is added to the clipboard tab or is changed, it is also copied to the system clipboard.

Passes text to Google Translate.

Convert indented line block (tabs, spaces or markdown headers) to an ASCII directory tree with the possibility to add a root element.

Example

A1
  B1
    C1
      D1
        E1
      D2
        E2
Z1
  Y1
    X1

Output (with root)

.
├─ A1
│  └─ B1
│     └─ C1
│        ├─ D1
│        │  └─ E1
│        └─ D2
│           └─ E2
└─ Z1
   └─ Y1
      └─ X1

Output (without root)

A1
└─ B1
   └─ C1
      ├─ D1
      │  └─ E1
      └─ D2
         └─ E2
Z1
└─ Y1
   └─ X1

Two commands to move items to trash and to undo removals.

Adds support for some features under Wayland compositors in KDE, Sway, Hyprland and possibly others.

Command "Paste Items when Activated" pastes items when activated (on double-click or Enter key) depending on application configuration (History configuration tab).

Paste behaviour is implemented with Shift+Insert shortcut. It works in most applications by default, but you may need to enable it for some (for example, for terminal emulators). Exact configuration changes vary by application. For example, for alacritty you should modify your alacritty.yml with next line:

  - { key: Insert, mods: Shift, action: Paste }

Getting window title is currently implemented only for KDE, Sway and Hyprland.

Requirements:

Stores clipboard continuously to a "clipboard.txt" (in home directory).

About

Useful commands for CopyQ clipboard manager.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published