From e2794629844c97ad4d39bf300e66ce3de0be7799 Mon Sep 17 00:00:00 2001 From: yasumori Date: Mon, 1 Aug 2022 15:07:46 -0400 Subject: [PATCH] allow plumbing with double click --- config.def.h | 5 +++++ x.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/config.def.h b/config.def.h index 548f76a..2a65fab 100644 --- a/config.def.h +++ b/config.def.h @@ -477,6 +477,11 @@ static char ascii_printable[] = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~"; +/* + * PLUMBMASK runs plumb_cmd on the selected word when double clicking while held down + */ +#define PLUMBMASK ShiftMask + /* * plumb_cmd is run on mouse button 3 click, with first NULL set to * current selection and with cwd set to the cwd of the active shell diff --git a/x.c b/x.c index 35fca28..f0c7eda 100644 --- a/x.c +++ b/x.c @@ -174,6 +174,7 @@ static void resize(XEvent *); static void focus(XEvent *); static uint buttonmask(uint); static int mouseaction(XEvent *, uint); +static void plumb(char *); static void brelease(XEvent *); static void bpress(XEvent *); static void bmotion(XEvent *); @@ -502,6 +503,11 @@ bpress(XEvent *e) xsel.tclick1 = now; selstart(evcol(e), evrow(e), snap); + + if (snap == SNAP_WORD && match(PLUMBMASK, e->xbutton.state)) { + xsetsel(getsel()); + plumb(xsel.primary); + } } } -- 2.37.1