If you use Wayland and have ever tried to paste a screenshot into a terminal application (VS Code terminal, Claude Code, etc.) and nothing happens (or even worse, binary stuff) instead of what you expected, this tool is for you. I.e you can't paste it as an image in Discord AND as a file path in your terminal apps. You have to choose ONE format, which is annoying.
For example, if i wanna debug complicated web development, i'd usually take a screenshot and show it to my LLM CLI. But when i take the picture, i cant just paste it in the terminal. I literally have to 1) take screenshot, 2) manually save it, 3) go to my file explorer, 4) find the damn thing, 5) copy it manually (bc ctrl+c doesnt cut it for some reason), and THEN 6) paste it into the LLM CLI in the terminal. So that i fixed.
- Connects directly to Wayland compositor
- Creates a clipboard data source
- Offers 6 MIME types simultaneously
- Serves the appropriate type when apps request clipboard content
- Mimics GNOME Nautilus clipboard format for maximum compatibility
wl-clip-multi uses the Wayland protocol directly (via pywayland) to offer 6 MIME types simultaneously:
x-special/gnome-copied-files- File path (for terminals)text/plain;charset=utf-8- Plain text pathtext/uri-list- Standard URI formatapplication/vnd.portal.filetransfer- XDG portalapplication/vnd.portal.files- XDG portal filesimage/png(or appropriate) - Raw content (for visual apps)
Apps then choose their preferred format when you paste.
This repo provides two tools:
wl-clip-multi: General-purpose multi-MIME clipboard tool for any filescreenshot-smart-clipboard: Complete screenshot solution with integrated multi-MIME clipboard (Hyprland)
pip install pywayland
sudo pacman -S wl-clip-persist # Arch/Manjaro
# or
yay -S wl-clip-persist # AURFor general clipboard use:
git clone https://github.com/mrdrbrdr/screenshot-smart-clipboard.git
cd screenshot-smart-clipboard
sudo cp bin/wl-clip-multi /usr/local/bin/
sudo chmod +x /usr/local/bin/wl-clip-multiFor integrated screenshot solution (Hyprland):
git clone https://github.com/mrdrbrdr/screenshot-smart-clipboard.git
cd screenshot-smart-clipboard
cp bin/screenshot-smart-clipboard ~/.local/bin/
chmod +x ~/.local/bin/screenshot-smart-clipboardThen bind it to a keybinding in your Hyprland config:
bind = , Print, exec, ~/.local/bin/screenshot-smart-clipboard
Without this, your clipboard only works for a split second:
Many Wayland systems run clipboard managers (like elephant-clipboard, cliphist) that use wl-paste --watch to monitor the clipboard. When they detect our multi-MIME clipboard, they read it and re-copy it - but only preserve 1-2 MIME types, destroying 6-type clipboard.
wl-clip-persist fixes this by reading ALL MIME types and preserving them.
Add to autostart:
Hyprland
Add to ~/.config/hypr/autostart.conf:
exec-once = wl-clip-persist --clipboard regularSway
Add to ~/.config/sway/config:
exec wl-clip-persist --clipboard regularGNOME (Wayland)
Create ~/.config/autostart/wl-clip-persist.desktop:
[Desktop Entry]
Type=Application
Name=wl-clip-persist
Exec=wl-clip-persist --clipboard regular
X-GNOME-Autostart-enabled=trueKDE Plasma (Wayland)
Create ~/.config/autostart/wl-clip-persist.sh:
#!/bin/bash
wl-clip-persist --clipboard regularMake it executable: chmod +x ~/.config/autostart/wl-clip-persist.sh
Then start it now (or reboot):
wl-clip-persist --clipboard regular &That's it basically.
See TECHNICAL.md for:
GPL-3.0
- wl-clipboard issue #71 - Multi-MIME discussion
- wl-clip-persist - Essential companion tool
- pywayland - Python Wayland bindings