Clipboard management using dmenu
CM_LAUNCHER=rofi) and xsel.
clipmenud, then run
clipmenuto select something to put on the clipboard. For systemd users, a user service called
clipmenudis packaged as part of the project.
For those using a systemd unit and not using a desktop environment which does it automatically, you must import
clipmenudknows which X server to use. For example, in your
~/.xinitrcdo this prior to launching clipmenud:
systemctl --user import-environment DISPLAY
You may wish to bind a shortcut in your window manager to launch
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, like so:
clipmenu -i -fn Terminus:size=8 -nb '#002b36' -nf '#839496' -sb '#073642' -sf '#93a1a1'
For a full list of environment variables that clipmenud can take, please see
The behavior of
clipmenudcan be customized through environment variables. Despite being only <300 lines, clipmenu has many useful features, including:
clipctl disable, reenabling with
clipmenud --helpto view all possible environment variables and what they do. If you manage
systemd, you can override the defaults by using
systemctl --user edit clipmenudto generate an override file.
Any dmenu-compliant application will work, but here are
CM_LAUNCHERconfigurations that are known to work:
rofi-script, for rofi's script mode
Several distributions, including Arch and Nix, provide clipmenu as an official package called
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
clipnotifyinstalled, and also
dmenuunless you plan to use a different launcher.
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:
clipmenuduses clipnotify to wait for new clipboard events.
clipmenuddetects changes to the clipboard contents, it writes them out to the cache directory and an index using a hash as the filename.
clipmenureads the index to find all available clips.
dmenuis executed to allow the user to select a clip.