Clipboard
Included with Macro DeckCopy text, images and files from a button, read the clipboard into a variable and react when something new is copied.
The Clipboard integration page with the switch turned on, ready to use without setup
- Copy text with variables in it, an image or files
- Read the clipboard text into a variable
- Check whether text, an image or files were copied
- Run automations when something new is copied
- Watching is off until you turn it on
The Clipboard integration works with the clipboard of the computer Macro Deck runs on. It comes with Macro Deck, is turned on from the start and needs no account or online service. Its actions work right away, without any setup.
What you can do
- Copy text puts a text on the clipboard, for example a reply you send often or a link. The text can span several lines and contain variables, such as
{{ vars.name }}. - Copy image puts an image file on the clipboard, ready to paste into a chat or an image editor.
- Copy files puts files and folders on the clipboard, as if you had copied them in your file manager.
- Read clipboard text writes the text on the clipboard into a variable, and Check clipboard content writes
trueorfalseinto a variable, depending on whether the clipboard holds text, an image or files. - Clear clipboard removes everything from the clipboard.
Watch the clipboard
The clipboard often holds things that should stay private, such as a password you just copied, so Macro Deck does not watch it until you turn that on. In the integration's settings, Watch the clipboard turns on three events for automations, Clipboard changed, Copied text matches and Clipboard content type changed, and variables that say what kind of content is on the clipboard. Only with Show clipboard text as a variable turned on as well does the copied text itself go into the clipboard_text variable. Both settings are off by default.
The events never fire for changes Macro Deck made itself, so a Copy text action cannot start an automation that reacts to clipboard changes and set off a loop.
Example setups
- A button that copies your stream's link with Copy text, ready to paste into a chat.
- A button that copies a logo or an emote with Copy image.
- An automation on Copied text matches with the pattern
^https?://that reacts whenever you copy a web address.
Macro Deck never logs or saves what is on the clipboard.
What you need
- Macro Deck 3 on Windows, macOS or Linux
- On Linux,
wl-clipboardin a Wayland session orxclipin an X11 session - For watching on Wayland, a desktop with the data-control protocol, such as KDE Plasma, Sway or Hyprland (not GNOME)
Set it up
Step 1: Check that the integration is turned on
In Macro Deck, click Integrations in the sidebar and click Clipboard. The switch at the top right is on by default; turn it on if it is off. The actions need nothing else.
Step 2: Add a Clipboard action to a button
On the Deck page, click a button. The deck must be unlocked: when the Lock button shows at the top right, it is. The editor opens with Short Press selected. Click + Add action, select Clipboard on the left of the Add action dialog and pick an action.
Step 3: Fill in the action
For Copy text, enter the Text. For Copy image, choose the Image file: PNG, JPEG, GIF, BMP or TIFF. For Copy files, enter one absolute path per row under Paths, or pick a file with Browse…, and add a row with + for each further file or folder. For Read clipboard text and Check clipboard content, choose the Variable that receives the result.
Step 4: Turn on watching (optional)
Only for the events and the variables: on the Overview tab of the Clipboard page, click Set up in the Configuration section. In Clipboard settings, turn on Watch the clipboard, and Show clipboard text as a variable if you need the copied text in a widget or a template. Changes take effect at once.
Step 5: Use the variables and events
With watching turned on, the Variables tab lists
clipboard_content_type,clipboard_has_text,clipboard_has_imageandclipboard_has_files, andclipboard_textwhen the text is shown too. To react to a copy, click Automations in the sidebar, create an automation and choose Clipboard changed, Copied text matches or Clipboard content type changed as its trigger.Step 6: Install the clipboard tool on Linux
On Linux, Macro Deck uses
wl-clipboardon Wayland andxclipon X11. Until the one for your session is installed, the Clipboard page shows The clipboard is not available. Install it, for example withsudo apt install wl-clipboardorsudo apt install xclip, and restart Macro Deck.
Actions6
Put these on a button or run them from a flow.
- Read clipboard text
- Stores the text on the clipboard in a variable. Fails when the clipboard holds no text or more than 1 MiB of text.
- Copy text
- Puts text on the clipboard, with variables in it.
- Copy image
- Puts a PNG, JPEG, GIF, BMP or TIFF file on the clipboard as an image.
- Copy files
- Puts files and folders on the clipboard so they can be pasted in a file manager. Every path must be absolute and exist.
- Clear clipboard
- Removes everything from the clipboard.
- Check clipboard content
- Stores true in a variable when the clipboard holds text, an image, files or any content, otherwise false.
Triggers3
A button or flow can react to these events.
- Clipboard changed
- Something new was copied. It carries the content type and, for text, the text. Needs Watch the clipboard.
- Copied text matches
- Copied text matches a regular expression. It carries the pattern, the text and the part that matched. Needs Watch the clipboard.
- Clipboard content type changed
- The kind of content changed, for example from text to an image. It carries the new and the previous content type. Needs Watch the clipboard.
Variables5
Show these values on buttons and widgets, or use them in conditions.
clipboard_content_type- What is on the clipboard: empty, text, image, files or other.
clipboard_has_text- Whether the clipboard holds text.
clipboard_has_image- Whether the clipboard holds an image.
clipboard_has_files- Whether the clipboard holds files.
clipboard_text- The text on the clipboard, up to 64 KiB. Only with Show clipboard text as a variable turned on.
Frequently asked questions
Why does my automation not run when I copy something?
The events only fire while Watch the clipboard is turned on in the integration's settings. They never fire for changes Macro Deck made itself, such as a Copy text action, and not for what is already on the clipboard when you turn watching on or start Macro Deck.
Why is there no clipboard_text variable?
clipboard_text exists only with both Watch the clipboard and Show clipboard text as a variable turned on. Turning either off removes it, so the last copied text does not stay behind. Text larger than 64 KiB is left out of the variable and the events; only the content type is reported.
Does Macro Deck save what I copy?
No. Macro Deck never logs or saves clipboard content. The text it reads stays in memory and reaches only the variables, events and actions you set up. With Show clipboard text as a variable turned on, anything that can read your variables can see the copied text while it is on the clipboard.
How do I make Copied text matches ignore case?
The Pattern is a regular expression and is case-sensitive. Start it with (?i) to ignore case, for example (?i)invoice.
Linux says The clipboard is not available. What do I install?
Install wl-clipboard in a Wayland session or xclip in an X11 session, for example with sudo apt install wl-clipboard, sudo dnf install xclip or sudo pacman -S wl-clipboard, and restart Macro Deck.
Why does watching not work on GNOME?
Watching on Wayland needs a desktop that supports the data-control protocol, as KDE Plasma, Sway and Hyprland do. GNOME does not, so the actions work but the integration shows Watching the clipboard is not supported, and the events and variables stay inactive.
More in Your computer
System
Included with Macro DeckControl your computer from your deck: apps, volume, commands, notifications, sleep and shutdown.
Keyboard
Included with Macro DeckPress shortcuts, type text and run key sequences on your computer from a button.
Mouse
Included with Macro DeckClick, move the pointer, drag and scroll on your computer from a button.
Wake on LAN
Included with Macro DeckTurn on a PC, NAS or other device on your network from a Macro Deck button.
AutoHotkey
Included with Macro DeckKeep your AutoHotkey v2 scripts in Macro Deck, run and stop them from a button and let them read and set variables.
ADB / Android Debug Bridge
Included with Macro DeckControl an Android phone or tablet over USB or Wi-Fi: wake it, start apps, tap, type and take screenshots.
Steam
Included with Macro DeckStart and close Steam games, and show what you play, your friends and your library on your deck.