aboutsummaryrefslogtreecommitdiff
path: root/x.c
diff options
context:
space:
mode:
authorTim Keller <tjkeller.xyz>2025-01-12 15:47:24 -0600
committerTim Keller <tjkeller.xyz>2025-01-12 15:47:24 -0600
commit1f166193fdae70800f0764cdce64eb9924013d1b (patch)
tree4c11a349abcf81b4ceed9677db03fcb865410338 /x.c
parent48010bf2c4ba3ca33b5c82bc256133a6893bff3a (diff)
downloadst-1f166193fdae70800f0764cdce64eb9924013d1b.tar.xz
st-1f166193fdae70800f0764cdce64eb9924013d1b.zip
add patch open selected
Diffstat (limited to 'x.c')
-rw-r--r--x.c16
1 files changed, 16 insertions, 0 deletions
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;