From 1f166193fdae70800f0764cdce64eb9924013d1b Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 12 Jan 2025 15:47:24 -0600 Subject: add patch open selected --- x.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'x.c') diff --git a/x.c b/x.c index 7e361d5..71a95ac 100644 --- a/x.c +++ b/x.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -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 *); @@ -312,6 +314,20 @@ selpaste(const Arg *dummy) xw.win, CurrentTime); } +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) { -- cgit v1.2.3