$NetBSD$ Add support for plumbing with the right click button. Inspired by `right click to plumb' patch. --- config.def.h.orig 2020-03-28 15:14:27.000000000 +0000 +++ config.def.h @@ -65,6 +65,8 @@ static int bellvolume = 0; /* default TERM value */ char *termname = "st-256color"; +char *plumber = "plumb" + /* * spaces per tab * --- st.c.orig 2020-05-21 20:15:34.000000000 +0000 +++ st.c @@ -721,7 +721,7 @@ sigchld(int a) int stat; pid_t p; - if ((p = waitpid(pid, &stat, WNOHANG)) < 0) + if ((p = waitpid(WAIT_ANY, &stat, WNOHANG)) < 0) die("waiting for pid %hd failed: %s\n", pid, strerror(errno)); if (pid != p) --- x.c.orig 2020-05-21 20:15:34.000000000 +0000 +++ x.c @@ -684,6 +684,8 @@ xsetsel(char *str) void brelease(XEvent *e) { + pid_t child; + if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) { mousereport(e); return; @@ -693,6 +695,16 @@ brelease(XEvent *e) return; if (e->xbutton.button == Button1) mousesel(e, 1); + else if (e->xbutton.button == Button3 && xsel.primary) { + switch (child = fork()) { + case -1: + return; + case 0: + execvp(plumber, (char *const []) + {plumber, xsel.primary, NULL }); + _exit(127); + } + } } void