X11 clipboard history and management using spmenu
Go to file
Chris Down 35a3cb2e8a Use /proc/self/fd/2 instead of /dev/stderr where possible
/dev/stderr is not standardised, whereas /proc/self/fd is provided by
the kernel. Add a fallback for non-Linux.
2017-10-29 02:08:25 +00:00
init systemd service: Don't restrict to only /tmp 2017-05-30 09:02:58 +01:00
tests Bump major_version to 4 2017-10-25 01:57:35 +01:00
.travis.yml tests: Add clipmenu test 2017-01-15 10:18:20 +00:00
clipmenu Bump major_version to 4 2017-10-25 01:57:35 +01:00
clipmenud Use /proc/self/fd/2 instead of /dev/stderr where possible 2017-10-29 02:08:25 +00:00
LICENSE License as public domain 2015-10-26 11:10:54 +00:00
README.md Add a note about using CM_ONESHOT, per #47 2017-05-30 08:55:27 +01:00

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

Demo

Demo

Usage

Start clipmenud, then run clipmenu to select something to put on the clipboard.

A systemd user service for starting clipmenud is included at init/clipmenud.service.

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'

How does it work?

The code is fairly simple and easy to follow, you may find it easier to read there, but it basically works like this:

clipmenud

  1. clipmenud polls the clipboard every 0.5 seconds (or another interval as configured with the CM_SLEEP environment variable). Unfortunately there's no interface to subscribe for changes in X11, so we must poll.

    Instead of polling, you can bind your copy key binding to also issue CM_ONESHOT=1 clipmenud. However, there's no generic way to do this, since any keys or mouse buttons could be bound to do this action in a number of ways.

  2. If clipmenud detects changes to the clipboard contents, it writes them out to the cache directory.

clipmenu

  1. clipmenu reads the cache directory 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.