X11 clipboard history and management using spmenu
Go to file
Chris Down 64661dffbf clipdel: Recreate cache_dir
After 80b697edd2, this is required.

Fixes #133.
2020-07-11 12:57:09 +01:00
init init: Don't set $DISPLAY 2020-06-09 15:20:57 +01:00
tests tests: Set EXIT trap to show temp contents 2020-03-30 19:20:39 +01:00
.travis.yml clipmenud: Allow disable with USR1 and enable with USR2 2020-03-25 19:13:22 +00:00
clipctl clipctl: Make pgrep regex less taxing 2020-03-28 14:12:49 +00:00
clipdel clipdel: Recreate cache_dir 2020-07-11 12:57:09 +01:00
clipfsck Use a single line cache file 2020-03-23 13:00:14 +00:00
clipmenu clipmenu: Preserve ordering of arguments for rofi -dmenu 2020-03-30 19:20:39 +01:00
clipmenud Add $DISPLAY check 2020-06-09 14:20:17 +01:00
LICENSE License as public domain 2015-10-26 11:10:54 +00:00
Makefile makefile: Install clipctl 2020-03-25 19:22:22 +00:00
README.md readme: List supported launchers 2020-03-30 19:13:26 +01:00

Tests

clipmenu is a simple clipboard manager using dmenu (or rofi with CM_LAUNCHER=rofi) and xsel.

Demo

Demo

Usage

Start clipmenud, then run clipmenu to select something to put on the clipboard. For systemd users, a user service called clipmenud is packaged as part of the project.

You may wish to bind a shortcut in your window manager to launch clipmenu.

All args passed to clipmenu are transparently dispatched to dmenu. That is, if you usually call dmenu with args to set colours and other properties, you can invoke clipmenu in exactly the same way to get the same effect, like so:

clipmenu -i -fn Terminus:size=8 -nb '#002b36' -nf '#839496' -sb '#073642' -sf '#93a1a1'

For a full list of environment variables that clipmenud can take, please see clipmenud --help.

Features

The behavior of clipmenud can be customized through environment variables. Despite being only <300 lines, clipmenu has many useful features, including:

  • Customising the maximum number of clips stored (default 1000)
  • Disabling clip collection temporarily with clipctl disable, reenabling with clipctl enable
  • Not storing clipboard changes from certain applications, like password managers
  • Taking direct ownership of the clipboard
  • ...and much more.

Check clipmenud --help to view all possible environment variables and what they do. If you manage clipmenud with systemd, you can override the defaults by using systemctl --user edit clipmenud to generate an override file.

Supported launchers

Any dmenu-compliant application will work, but here are CM_LAUNCHER configurations that are known to work:

Installation

Several distributions, including Arch and Nix, provide clipmenu as an official package called clipmenu.

Manual installation

If your distribution doesn't provide a package, you can manually install using make install (or better yet, create a package for your distribution!). You will need xsel and clipnotify installed, and also dmenu unless you plan to use a different launcher.

How does it work?

clipmenud is less than 300 lines, and clipmenu is less than 100, so hopefully it should be fairly self-explanatory. However, at the most basic level:

clipmenud

  1. clipmenud uses clipnotify to wait for new clipboard events.
  2. If clipmenud detects changes to the clipboard contents, it writes them out to the cache directory and an index using a hash as the filename.

clipmenu

  1. clipmenu reads the index to find all available clips.
  2. dmenu is executed to allow the user to select a clip.
  3. After selection, the clip is put onto the PRIMARY and CLIPBOARD X selections.