logo

st

Unnamed repository; edit this file 'description' to name the repository.
commit: ae95d79d585d2de83406e7166bf4140a37f1a765
parent: 9b55f7d3897cc76db1f13c3a75b09e440a20a4af
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 19 Jun 2020 09:32:52 +0200

Right-click to plumb (sh-less, no OSC 7 / cwd support)

Compared to http://st.suckless.org/patches/right_click_to_plumb/

- sh is useless here and could be an issue because of the extra parsing.
- OSC 7 is advisory at best, doesn't have much of a standard format and the
widely accepted one is the file-schema URI which means extraneous parsing
to be done. The alternative is to get the cwd of the shell but it's not a
transparent value for the user when a remote shell such as SSH is used.

Diffstat:

Mconfig.def.h3++-
Mx.c15+++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h @@ -191,7 +191,8 @@ static uint forcemousemod = ShiftMask; */ static MouseShortcut mshortcuts[] = { /* mask button function argument release */ - { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, + { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, + { XK_ANY_MOD, Button3, selplumb, {.s = "plumb"}, 1 }, { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} }, diff --git a/x.c b/x.c @@ -55,6 +55,7 @@ static void clipcopy(const Arg *); static void clippaste(const Arg *); static void numlock(const Arg *); static void selpaste(const Arg *); +static void selplumb(const Arg *); static void swapcolors(const Arg *); static void zoom(const Arg *); static void zoomabs(const Arg *); @@ -290,6 +291,20 @@ selpaste(const Arg *dummy) } void +selplumb(const Arg *arg) +{ + pid_t child; + + switch(child = fork()) { + case -1: + return; + case 0: + execvp(arg->s, (char *const[]){arg->s, xsel.primary, 0}); + exit(127); + } +} + +void numlock(const Arg *dummy) { win.mode ^= MODE_NUMLOCK;