From: Michael D. Lowis Date: Thu, 8 Mar 2018 02:34:43 +0000 (-0500) Subject: added right-click fetch functionality X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=0024ca797a27cc007c51664bf644856c2eae5cde;p=proto%2Fiwe.git added right-click fetch functionality --- diff --git a/.gitignore b/.gitignore index 5761abc..155f732 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ *.o +config.h +demnu +dmenu +dwm +slock +st diff --git a/st/st.c b/st/st.c index d282e79..a4ce2e0 100644 --- a/st/st.c +++ b/st/st.c @@ -552,6 +552,9 @@ static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; static Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; static Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; +char *cwd; +char *plumber_cmd = "tfetch"; + /* Font Ring Cache */ enum { FRC_NORMAL, @@ -1287,12 +1290,17 @@ brelease(XEvent *e) if (e->xbutton.button == Button2) { selpaste(NULL); + } else if (e->xbutton.button == Button3 && !fork()) { + char cmd[100 + strlen(cwd)]; + sprintf(cmd, "(cd %s ; tfetch '%s')", cwd, sel.primary); + exit(execvp( "sh", (char*[]){ "/bin/sh", "-c", cmd, 0 })); } else if (e->xbutton.button == Button1) { if (sel.mode == SEL_READY) { getbuttoninfo(e); selcopy(e->xbutton.time); - } else + } else { selclear(NULL); + } sel.mode = SEL_IDLE; tsetdirt(sel.nb.y, sel.ne.y); } @@ -2558,6 +2566,10 @@ strhandle(void) switch (strescseq.type) { case ']': /* OSC -- Operating System Command */ switch (par) { + case 7: + if (narg > 1 && access(strescseq.args[1], X_OK) != -1) + cwd = strescseq.args[1]; + return; case 0: case 1: case 2: