aboutsummaryrefslogtreecommitdiff
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
parent7b1493a63162875ba591883e480bd36a063cf222 (diff)
add paste from clipboard
-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";
52static unsigned int lines = 0; 52static unsigned int lines = 0;
53static unsigned long normcol[ColLast]; 53static unsigned long normcol[ColLast];
54static unsigned long selcol[ColLast]; 54static unsigned long selcol[ColLast];
55static Atom utf8; 55static Atom clip, utf8;
56static Bool topbar = True; 56static Bool topbar = True;
57static DC *dc; 57static DC *dc;
58static Item *items = NULL; 58static Item *items = NULL;
@@ -275,7 +275,8 @@ keypress(XKeyEvent *ev) {
275 insert(NULL, nextrune(-1) - cursor); 275 insert(NULL, nextrune(-1) - cursor);
276 break; 276 break;
277 case XK_y: /* paste selection */ 277 case XK_y: /* paste selection */
278 XConvertSelection(dc->dpy, XA_PRIMARY, utf8, utf8, win, CurrentTime); 278 XConvertSelection(dc->dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY,
279 utf8, utf8, win, CurrentTime);
279 return; 280 return;
280 default: 281 default:
281 return; 282 return;
@@ -517,6 +518,7 @@ setup(void) {
517 selcol[ColBG] = getcolor(dc, selbgcolor); 518 selcol[ColBG] = getcolor(dc, selbgcolor);
518 selcol[ColFG] = getcolor(dc, selfgcolor); 519 selcol[ColFG] = getcolor(dc, selfgcolor);
519 520
521 clip = XInternAtom(dc->dpy, "CLIPBOARD", False);
520 utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False); 522 utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
521 523
522 /* calculate menu geometry */ 524 /* calculate menu geometry */