aboutsummaryrefslogtreecommitdiff
path: root/dmenu.c
diff options
context:
space:
mode:
authorConnor Lane Smith <cls@lubutu.com>2011-10-26 13:28:15 +0100
committerConnor Lane Smith <cls@lubutu.com>2011-10-26 13:28:15 +0100
commitdc77337ef35a52e1da8a74339bc39f32e6e5ab56 (patch)
treecd7b5c684365322e46983c45e6c5e3a796bcf169 /dmenu.c
parent7b1493a63162875ba591883e480bd36a063cf222 (diff)
downloaddmenu-dc77337ef35a52e1da8a74339bc39f32e6e5ab56.tar.gz
dmenu-dc77337ef35a52e1da8a74339bc39f32e6e5ab56.tar.bz2
dmenu-dc77337ef35a52e1da8a74339bc39f32e6e5ab56.zip
add paste from clipboard
Diffstat (limited to 'dmenu.c')
-rw-r--r--dmenu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/dmenu.c b/dmenu.c
index 5e01441..3f48d30 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -52,7 +52,7 @@ static const char *selfgcolor = "#ffffff";
static unsigned int lines = 0;
static unsigned long normcol[ColLast];
static unsigned long selcol[ColLast];
-static Atom utf8;
+static Atom clip, utf8;
static Bool topbar = True;
static DC *dc;
static Item *items = NULL;
@@ -275,7 +275,8 @@ keypress(XKeyEvent *ev) {
insert(NULL, nextrune(-1) - cursor);
break;
case XK_y: /* paste selection */
- XConvertSelection(dc->dpy, XA_PRIMARY, utf8, utf8, win, CurrentTime);
+ XConvertSelection(dc->dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY,
+ utf8, utf8, win, CurrentTime);
return;
default:
return;
@@ -517,6 +518,7 @@ setup(void) {
selcol[ColBG] = getcolor(dc, selbgcolor);
selcol[ColFG] = getcolor(dc, selfgcolor);
+ clip = XInternAtom(dc->dpy, "CLIPBOARD", False);
utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
/* calculate menu geometry */