diff options
author | Tim Keller <tjkeller.xyz> | 2025-01-12 15:47:24 -0600 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2025-01-12 15:47:24 -0600 |
commit | 1f166193fdae70800f0764cdce64eb9924013d1b (patch) | |
tree | 4c11a349abcf81b4ceed9677db03fcb865410338 | |
parent | 48010bf2c4ba3ca33b5c82bc256133a6893bff3a (diff) | |
download | st-1f166193fdae70800f0764cdce64eb9924013d1b.tar.xz st-1f166193fdae70800f0764cdce64eb9924013d1b.zip |
add patch open selected
-rw-r--r-- | PATCHES | 1 | ||||
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | st.c | 10 | ||||
-rw-r--r-- | x.c | 16 |
4 files changed, 29 insertions, 0 deletions
@@ -5,6 +5,7 @@ st-csi_22_23-0.8.5.diff st-desktopentry-0.8.5.diff st-drag-n-drop-0.9.2.diff st-expected-anysize-0.9.diff +st-open-selected-0.9.2.diff st-scrollback-0.9.2.diff st-scrollback-reflow-0.9.2.diff st-themed_cursor-0.8.1.diff diff --git a/config.def.h b/config.def.h index c95f93a..d9ce6cc 100644 --- a/config.def.h +++ b/config.def.h @@ -196,6 +196,7 @@ static MouseShortcut mshortcuts[] = { { ControlMask, Button5, zoom, {.f = -1}, 0 }, { XK_ANY_MOD, Button4, kscrollup, {.i = 3}, 0 }, { XK_ANY_MOD, Button5, kscrolldown, {.i = 3}, 0 }, + { ControlMask, Button2, selopen, {.i = 0}, 1 }, { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, { XK_ANY_MOD, Button3, selpaste, {.i = 0}, 1 }, { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, @@ -226,6 +227,7 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, { MODKEY, XK_l, copyurl, {.i = 0} }, { MODKEY|ShiftMask, XK_L, copyurl, {.i = 1} }, + { TERMMOD, XK_l, selopen, {.i = 0} }, { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, }; @@ -2236,6 +2236,16 @@ strhandle(void) if (narg > 1) xsettitle(strescseq.args[1], 0); return; + case 7: + if (strstr(strescseq.args[1], "file://") != strescseq.args[1]) { + fprintf(stderr, "erresc: dir %s must have prefix 'file://'\n", + strescseq.args[1]); + return; + } + if (chdir(strescseq.args[1] + 7) != 0) /* +7 to remove prefix */ + fprintf(stderr, "erresc: invalid directory %s\n", + strescseq.args[1]); + return; case 52: if (narg > 2 && allowwindowops) { dec = base64dec(strescseq.args[2]); @@ -5,6 +5,7 @@ #include <locale.h> #include <signal.h> #include <sys/select.h> +#include <sys/wait.h> #include <time.h> #include <unistd.h> #include <libgen.h> @@ -64,6 +65,7 @@ static void clipcopy(const Arg *); static void clippaste(const Arg *); static void numlock(const Arg *); static void selpaste(const Arg *); +static void selopen(const Arg *); static void zoom(const Arg *); static void zoomabs(const Arg *); static void zoomreset(const Arg *); @@ -313,6 +315,20 @@ selpaste(const Arg *dummy) } void +selopen(const Arg *dummy) +{ + pid_t chpid; + + if ((chpid = fork()) == 0) { + if (fork() == 0) + execlp("xdg-open", "xdg-open", getsel(), NULL); + exit(1); + } + if (chpid > 0) + waitpid(chpid, NULL, 0); +} + +void numlock(const Arg *dummy) { win.mode ^= MODE_NUMLOCK; |