Hi,

Inspired on dmenu scripts (dmenu_path and dmenu_run) I have written a little 
dmenu-based clipboard manager in bash called "dclip".
It stores a desired number of previous clipboard selections on a cache file and 
allows you to access each one for pasting.
It has dmenu and xclip as dependencies. I have used xclip instead of xsel due 
to problems with character encoding. I also have to do a "dirty trick" in order 
to manage multiline selections.

You can add something like the following lines to the dwm/config.h to call the 
program with M+C+c and M+C+v:

static const char *dclipcmd[] = { "dclip", "paste", "-fn", font, "-nb", 
normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor , "-sf", selfgcolor, NULL };
# and in the keys[] section:
{ MODKEY|ControlMask,           XK_c,                   spawn,          
SHCMD("exec dclip copy") },
{ MODKEY|ControlMask,           XK_v,                   spawn,          {.v = 
dclipcmd } },

Note that I don't use exec for the "paste" because of the parameters passed to 
dmenu.

The way to use dclip would be:
* To copy: Make a selection and store it with M+C+c
* To paste: M+C+v, (dmenu appears presenting the cache of the clipboard) select 
the element to paste, Enter, Shift+Insert. 
The best part is that you can use the potential of dmenu to make searchs, 
append characters to selections, and even introduce elements directly to the 
clipboard (M+C+v, write, Enter).

Hope you like it.

Kind Regards,
Delta

Attachment: dclip
Description: Binary data

Reply via email to