From b6103ff6a77bd410cec7e084cec56c6732d85f4a Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sun, 23 May 2021 13:16:26 +0200 Subject: [PATCH] Adding support for ctrl+v to paste --- README.md | 2 ++ dmenu.c | 4 ++++ patches.def.h | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 9783ba7..fa707e1 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ dmenu, how to install it and how it works. ### Changelog: +2021-05-23 - Adding support for `ctrl+v` to paste + 2021-05-17 - Added the restrict return, no sort, gridnav and plain-prompt (listfullwidth) patches 2021-05-15 - Added the tsv and printindex patches diff --git a/dmenu.c b/dmenu.c index 700e126..ed848e8 100644 --- a/dmenu.c +++ b/dmenu.c @@ -828,6 +828,10 @@ keypress(XKeyEvent *ev) break; case XK_y: /* paste selection */ case XK_Y: + #if CTRL_V_TO_PASTE_PATCH + case XK_v: + case XK_V: + #endif // CTRL_V_TO_PASTE_PATCH XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, utf8, utf8, win, CurrentTime); return; diff --git a/patches.def.h b/patches.def.h index 687080d..cc61afb 100644 --- a/patches.def.h +++ b/patches.def.h @@ -31,6 +31,11 @@ */ #define COLOR_EMOJI_PATCH 0 +/* Minor patch to enable the use of Ctrl+v (XA_PRIMARY) and Ctrl+Shift+v (CLIPBOARD) to paste. + * By default dmenu only supports Ctrl+y and Ctrl+Shift+y to paste. + */ +#define CTRL_V_TO_PASTE_PATCH 0 + /* This patch adds a flag (-dy) which makes dmenu run the command given to it whenever input * is changed with the current input as the last argument and update the option list according * to the output of that command.