commit 69f095feeb5fc11f3422dc6ce9e22a05daa4f558
Author: DanMan <[email protected]>
Date:   Wed Jul 24 19:25:04 2019 -0400

    [surf][patch] playexternal function to pipe uri to mpv

diff --git a/surf.suckless.org/patches/playexternal/index.md 
b/surf.suckless.org/patches/playexternal/index.md
new file mode 100644
index 00000000..e9b99486
--- /dev/null
+++ b/surf.suckless.org/patches/playexternal/index.md
@@ -0,0 +1,28 @@
+Play External
+============
+
+Description
+-----------
+
+This patch makes use of the following existing macro to pipe the current page 
uri to mpv when a hotkey is pressed.
+
+       /* VIDEOPLAY(URI) */
+       #define VIDEOPLAY(u) {\
+               .v = (const char *[]){ "/bin/sh", "-c", \
+                    "mpv --really-quiet \"$0\"", u, NULL \
+               } \
+       }
+
+To customize the hotkey just change the following line in your config.h. 
(patch adds this in config.def.h).
+       { MODKEY,                GDK_KEY_w,      playexternal, { 0 } },
+
+
+Download
+--------
+
+* 
[surf-playexternal-20190724-b814567.diff](surf-playexternal-20190724-b814567.diff)
 (1.6K) (20190724)
+
+Author
+------
+
+* Daniel Nakhimovich <[email protected]>
diff --git 
a/surf.suckless.org/patches/playexternal/surf-playexternal-20190724-b814567.diff
 
b/surf.suckless.org/patches/playexternal/surf-playexternal-20190724-b814567.diff
new file mode 100644
index 00000000..5c10b097
--- /dev/null
+++ 
b/surf.suckless.org/patches/playexternal/surf-playexternal-20190724-b814567.diff
@@ -0,0 +1,54 @@
+From 95e17b5bd428173c83e60cec9cd5666cfe9066fa Mon Sep 17 00:00:00 2001
+From: DanMan <[email protected]>
+Date: Wed, 24 Jul 2019 18:47:46 -0400
+Subject: [PATCH] added playexternal hotkey function
+
+---
+ config.def.h |  2 ++
+ surf.c       | 10 ++++++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 6d3135e..5fa0d9d 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -105,6 +105,8 @@ static Key keys[] = {
+       { MODKEY,                GDK_KEY_f,      spawn,      
SETPROP("_SURF_FIND", "_SURF_FIND") },
+       { MODKEY,                GDK_KEY_slash,  spawn,      
SETPROP("_SURF_FIND", "_SURF_FIND") },
+ 
++      { MODKEY,                GDK_KEY_w,      playexternal, { 0 } },
++
+       { 0,                     GDK_KEY_Escape, stop,       { 0 } },
+       { MODKEY,                GDK_KEY_c,      stop,       { 0 } },
+ 
+diff --git a/surf.c b/surf.c
+index 93a1629..e74e9df 100644
+--- a/surf.c
++++ b/surf.c
+@@ -217,6 +217,7 @@ static void togglefullscreen(Client *c, const Arg *a);
+ static void togglecookiepolicy(Client *c, const Arg *a);
+ static void toggleinspector(Client *c, const Arg *a);
+ static void find(Client *c, const Arg *a);
++static void playexternal(Client *c, const Arg *a);
+ 
+ /* Buttons */
+ static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h);
+@@ -1648,6 +1649,15 @@ clickexternplayer(Client *c, const Arg *a, 
WebKitHitTestResult *h)
+       spawn(c, &arg);
+ }
+ 
++void
++playexternal(Client *c, const Arg *a)
++{
++      Arg arg;
++
++      arg = (Arg)VIDEOPLAY(geturi(c));
++      spawn(c, &arg);
++}
++
+ int
+ main(int argc, char *argv[])
+ {
+-- 
+2.22.0
+


Reply via email to