You are not logged in.

#1 2020-12-31 06:14:31

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

clip.sh - turn xclip into a clipboard manager

Hello.

I made this script that effectively turns xclip into a clipboard manager for XA_CLIPBOARD (CTRL+C/CTRL+V).

Motivation:

No clipboard manager really did what I wanted, which is:

  • Keep the clipboard data consistently after closing the application.

  • Don't depend on KDE or Gnome or depend on any daemons, so it's suitable for running in non-DE environment, e.g. Openbox.

  • Support images, and copying files around in common file managers (or any other funky format I may encounter).

  • Do not impact any other applications in any way.

  • I don't care about history.

xfce4-clipman-plugin was close to meet the requirements I had, but was causing slow exit for other applications.

This script keeps an instance of xclip running, and tries to guess the format based on '_pref' values defined in the script.
For example, if one of the available targets in the clipboard is 'image/png' and it finds 'image/png' in _pref, it will use that format first (if it doesn't find the format, it will default to 'UTF8_STRING').
This works reasonably well, and makes the clipboard behave like on Windows regarding pasting data when the application closes.

The script:

github

Configuration:

Copying text, images, and files in some file managers should work out of the box.

If you need to support some custom format, run the script and examine the targets when you copy the data, e.g.:

-> Preferred targets: image/png text/uri-list code/file-list
-> Clipboard targets: TIMESTAMP TARGETS SAVE_TARGETS MULTIPLE strange/format

Add the strange/format from clipboard targets to '_pref' variable.

* 01.01.2020. fixed some issues
* 02.02.2020. code cleanup
* 09.06.2021. fixed bugs with xfreerdp clipboard

Last edited by karabaja4 (2021-06-14 22:19:30)

Offline

Board footer

Powered by FluxBB