commit 9d5a241f1dbe10c96257a56b62dfd9d3767a68f1
parent 09c32b025ea3e4e3d7b0d949035b4f104f7e10e8
Author: Chris Down <chris@chrisdown.name>
Date: Fri, 6 Jan 2017 17:50:09 +0000
Document behaviour in README
Diffstat:
M | README.md | | | 30 | +++++++++++++++++++++++++++--- |
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -1,11 +1,35 @@
clipmenu is a simple clipboard manager using [dmenu][] and [xsel][].
-To use it, start the `clipmenud` daemon, and then call `clipmenu` to launch
-`dmenu`. Upon choosing an entry, it is copied to the clipboard.
+# Usage
+
+Start `clipmenud`, then run `clipmenu` to select something to put on the
+clipboard.
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.
+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 `CLIPMENUD_SLEEP` environment variable. Unfortunately
+ there's no interface to subscribe for changes in X11, so we must poll.
+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.
[dmenu]: http://tools.suckless.org/dmenu/
[xsel]: http://www.vergenet.net/~conrad/software/xsel/