README.md (3441B)
1clipmenu is a simple clipboard manager using [dmenu][] (or [rofi][] with 2`CM_LAUNCHER=rofi`) and [xsel][]. 3 4# Demo 5 6![Demo](https://cloud.githubusercontent.com/assets/660663/24079784/6f76da94-0c88-11e7-8251-40b1f02ebf3c.gif) 7 8# Usage 9 10## clipmenud 11 12Start `clipmenud`, then run `clipmenu` to select something to put on the 13clipboard. For systemd users, a user service called `clipmenud` is packaged as 14part of the project. 15 16For those using a systemd unit and not using a desktop environment which does 17it automatically, you must import `$DISPLAY` so that `clipmenud` knows which X 18server to use. For example, in your `~/.xinitrc` do this prior to launching 19clipmenud: 20 21 systemctl --user import-environment DISPLAY 22 23## clipmenu 24 25You may wish to bind a shortcut in your window manager to launch `clipmenu`. 26 27All args passed to clipmenu are transparently dispatched to dmenu. That is, if 28you usually call dmenu with args to set colours and other properties, you can 29invoke clipmenu in exactly the same way to get the same effect, like so: 30 31 clipmenu -i -fn Terminus:size=8 -nb '#002b36' -nf '#839496' -sb '#073642' -sf '#93a1a1' 32 33For a full list of environment variables that clipmenud can take, please see 34`clipmenud --help`. 35 36# Features 37 38The behavior of `clipmenud` can be customized through environment variables. 39Despite being only <300 lines, clipmenu has many useful features, including: 40 41* Customising the maximum number of clips stored (default 1000) 42* Disabling clip collection temporarily with `clipctl disable`, reenabling with 43 `clipctl enable` 44* Not storing clipboard changes from certain applications, like password 45 managers 46* Taking direct ownership of the clipboard 47* ...and much more. 48 49Check `clipmenud --help` to view all possible environment variables and what 50they do. If you manage `clipmenud` with `systemd`, you can override the 51defaults by using `systemctl --user edit clipmenud` to generate an override 52file. 53 54# Supported launchers 55 56Any dmenu-compliant application will work, but here are `CM_LAUNCHER` 57configurations that are known to work: 58 59- `dmenu` (the default) 60- `fzf` 61- `rofi` 62- `rofi-script`, for [rofi's script 63 mode](https://github.com/davatorium/rofi-scripts/tree/master/mode-scripts) 64 65# Installation 66 67Several distributions, including Arch and Nix, provide clipmenu as an official 68package called `clipmenu`. 69 70## Manual installation 71 72If your distribution doesn't provide a package, you can manually install using 73`make install` (or better yet, create a package for your distribution!). You 74will need `xsel` and `clipnotify` installed, and also `dmenu` unless you plan 75to use a different launcher. 76 77# How does it work? 78 79clipmenud is less than 300 lines, and clipmenu is less than 100, so hopefully 80it should be fairly self-explanatory. However, at the most basic level: 81 82## clipmenud 83 841. `clipmenud` uses [clipnotify](https://github.com/cdown/clipnotify) to wait 85 for new clipboard events. 862. If `clipmenud` detects changes to the clipboard contents, it writes them out 87 to the cache directory and an index using a hash as the filename. 88 89## clipmenu 90 911. `clipmenu` reads the index to find all available clips. 922. `dmenu` is executed to allow the user to select a clip. 933. After selection, the clip is put onto the PRIMARY and CLIPBOARD X 94 selections. 95 96[dmenu]: http://tools.suckless.org/dmenu/ 97[rofi]: https://github.com/DaveDavenport/Rofi 98[xsel]: http://www.vergenet.net/~conrad/software/xsel/