clipmenu-spmenu/README.md

99 lines
3.4 KiB
Markdown
Raw Normal View History

2018-02-20 13:00:24 +01:00
clipmenu is a simple clipboard manager using [dmenu][] (or [rofi][] with
`CM_LAUNCHER=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
2020-10-17 01:47:39 +02:00
## clipmenud
2017-01-06 18:50:09 +01:00
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.
2020-10-17 01:47:39 +02:00
For those using a systemd unit and not using a desktop environment which does
it automatically, you must import `$DISPLAY` so that `clipmenud` knows which X
server to use. For example, in your `~/.xinitrc` do this prior to launching
clipmenud:
systemctl --user import-environment DISPLAY
## clipmenu
You may wish to bind a shortcut in your window manager to launch `clipmenu`.
2017-02-17 17:45:03 +01: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
For a full list of environment variables that clipmenud can take, please see
`clipmenud --help`.
2018-03-12 01:21:53 +01:00
# 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.
2020-03-30 20:13:26 +02:00
# Supported launchers
Any dmenu-compliant application will work, but here are `CM_LAUNCHER`
configurations that are known to work:
- `dmenu` (the default)
- `fzf`
- `rofi`
- `rofi-script`, for [rofi's script
mode](https://github.com/davatorium/rofi-scripts/tree/master/mode-scripts)
2018-08-21 21:45:30 +02:00
# 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.
2018-08-21 21:45:30 +02:00
2017-01-06 18:50:09 +01:00
# 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:
2017-01-06 18:50:09 +01:00
## clipmenud
1. `clipmenud` uses [clipnotify](https://github.com/cdown/clipnotify) to wait
for new clipboard events.
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 and an index using a hash as the filename.
2017-01-06 18:50:09 +01:00
## clipmenu
1. `clipmenu` reads the index to find all available clips.
2017-01-06 18:50:09 +01:00
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.
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
[xsel]: http://www.vergenet.net/~conrad/software/xsel/