aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PATCHES1
-rw-r--r--config.def.h2
-rw-r--r--st.c10
-rw-r--r--x.c16
4 files changed, 29 insertions, 0 deletions
diff --git a/PATCHES b/PATCHES
index 204f294..290d230 100644
--- a/PATCHES
+++ b/PATCHES
@@ -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} },
};
diff --git a/st.c b/st.c
index 95dcac4..876f5cc 100644
--- a/st.c
+++ b/st.c
@@ -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]);
diff --git a/x.c b/x.c
index 7e361d5..71a95ac 100644
--- a/x.c
+++ b/x.c
@@ -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;