Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.5 KiB

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