2017-03-19 08:55:57 +01:00
|
|
|
clipmenu is a simple clipboard manager using [dmenu][] (or [rofi][]) and
|
|
|
|
[xsel][].
|
2014-02-05 10:42:35 +01:00
|
|
|
|
2017-03-19 10:43:39 +01:00
|
|
|
# Demo
|
|
|
|
|
|
|
|
![Demo](https://cloud.githubusercontent.com/assets/660663/24079784/6f76da94-0c88-11e7-8251-40b1f02ebf3c.gif)
|
|
|
|
|
2017-01-06 18:50:09 +01:00
|
|
|
# Usage
|
|
|
|
|
|
|
|
Start `clipmenud`, then run `clipmenu` to select something to put on the
|
|
|
|
clipboard.
|
2014-02-05 10:42:35 +01:00
|
|
|
|
2017-02-17 17:45:03 +01:00
|
|
|
A systemd user service for starting clipmenud is included at
|
|
|
|
[init/clipmenud.service](https://github.com/cdown/clipmenu/blob/develop/init/clipmenud.service).
|
|
|
|
|
2015-07-09 10:53:06 +02:00
|
|
|
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
|
2017-01-06 18:50:09 +01:00
|
|
|
invoke clipmenu in exactly the same way to get the same effect, like so:
|
|
|
|
|
2017-01-12 09:34:41 +01:00
|
|
|
clipmenu -i -fn Terminus:size=8 -nb '#002b36' -nf '#839496' -sb '#073642' -sf '#93a1a1'
|
2017-01-06 18:50:09 +01:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2018-02-06 00:52:37 +01:00
|
|
|
1. `clipmenud` uses [clipnotify](https://github.com/cdown/clipnotify) to wait
|
|
|
|
for new clipboard events. If clipnotify is not present on the system, we
|
|
|
|
poll every 0.5 seconds (or another interval as configured with the
|
|
|
|
`CM_SLEEP` environment variable).
|
|
|
|
|
|
|
|
You can also 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.
|
2017-01-06 18:50:09 +01:00
|
|
|
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.
|
2015-07-09 10:53:06 +02:00
|
|
|
|
2014-02-05 10:42:35 +01:00
|
|
|
[dmenu]: http://tools.suckless.org/dmenu/
|
2017-03-19 08:55:57 +01:00
|
|
|
[rofi]: https://github.com/DaveDavenport/Rofi
|
2014-02-05 10:48:31 +01:00
|
|
|
[xsel]: http://www.vergenet.net/~conrad/software/xsel/
|