sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 69f095feeb5fc11f3422dc6ce9e22a05daa4f558
parent 2e2fc60f9af8fd171c301b64ead7d6594e2f639c
Author: DanMan <dnahimov@gmail.com>
Date:   Wed, 24 Jul 2019 19:25:04 -0400

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

Diffstat:
Asurf.suckless.org/patches/playexternal/index.md | 28++++++++++++++++++++++++++++
Asurf.suckless.org/patches/playexternal/surf-playexternal-20190724-b814567.diff | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/surf.suckless.org/patches/playexternal/index.md 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 <dnahimov@gmail.com> diff --git a/surf.suckless.org/patches/playexternal/surf-playexternal-20190724-b814567.diff 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 <dnahimov@gmail.com> +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 +