Had no luck with any of the diffs on the suckless homepage, here's one that works.
extracted diff code from https://github.com/mattiadr/st :
extracted diff code from https://github.com/mattiadr/st :
C:
--- x.c 2020-06-19 11:29:45.000000000 +0200
+++ x.c-new 2020-06-24 23:11:11.731349000 +0200
@@ -684,6 +684,8 @@
void
brelease(XEvent *e)
{
+ char cmd[100 + strlen(plumber_cmd)];
+
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) {
mousereport(e);
return;
@@ -693,6 +695,18 @@
return;
if (e->xbutton.button == Button1)
mousesel(e, 1);
+ else if (e->xbutton.button == Button3) {
+ if (!getsel())
+ selstart(evcol(e), evrow(e), SNAP_WORD);
+ switch(fork()) {
+ case -1:
+ return;
+ case 0:
+ snprintf(cmd, 99, plumber_cmd, getsel());
+ execvp("sh", (char *const []) { "/bin/sh", "-c", cmd, NULL });
+ exit(127);
+ }
+ }
}
void
--- config.def.h 2020-06-19 11:29:45.000000000 +0200
+++ config.def.h-new 2020-06-24 23:13:35.751191000 +0200
@@ -68,6 +68,12 @@
static unsigned int cursorthickness = 2;
/*
+ * command executed when right click is pressed, %s will be substituted with
+ * current selection.
+ */
+static char *plumber_cmd = "xdg-open %s";
+
+/*
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
* it
*/