Linux Clipboard Behavior and xclip Tips for X11 UsersLinux Clipboard Behavior and xclip Tips for X11 Users
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
Copied something on Linux, closed the app, and the paste came up empty?
It's not a bug. On X11 the clipboard holds no data, only a promise. The app you copied from keeps the content and hands it over when you paste. Close the app and the promise goes with it.
A few xclip one-liners that help on X11 (Xfce, MATE, Cinnamon, any Xorg session)
1) Keep copied text alive after the app closes
`xclip -selection clipboard -o | xclip -selection clipboard`
2) The same line strips formatting, so it doubles as "paste as plain text" for rich text from a browser or office app.
3) See every format an app offered (HTML, PNG, file lists and more)
`xclip -selection clipboard -t TARGETS -o`
4) Linux has two clipboards. Selecting text fills PRIMARY (middle-click pastes it), Ctrl+C fills CLIPBOARD. Read the selection without touching your clipboard
`xclip -selection primary -o`
5) If you use a clipboard manager, make sure it respects x-kde-passwordManagerHint. KeePassXC sets it so passwords stay out of your history. Run the TARGETS command right after copying a password to see it.
On Wayland it works differently. Use wl-copy and wl-paste from wl-clipboard.
I got tired of doing this by hand, so I wrapped it into SuperV, a free, open-source Win+V-style clipboard history for X11. It does pins, images, paste as plain text, and skips passwords. github.com/MilanG-Ne/superv
What's your clipboard setup on Linux?
Post image
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started