commit dc77337ef35a52e1da8a74339bc39f32e6e5ab56 from: Connor Lane Smith date: Wed Oct 26 12:28:15 2011 UTC add paste from clipboard commit - 7b1493a63162875ba591883e480bd36a063cf222 commit + dc77337ef35a52e1da8a74339bc39f32e6e5ab56 blob - 5e01441912c3cfb13e7e960b9afe6e748f29efef blob + 3f48d30489291389243ee4258f427298cb9f6eeb --- dmenu.c +++ 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 */