Introduction
Introduction Statistics Contact Development Disclaimer Help
tAdd mouse function to play medias in external player - surf - customized build…
git clone git://src.adamsgaard.dk/surf
Log
Files
Refs
README
LICENSE
---
commit 954a7181970f61acd54ce82cdff4195e72530db1
parent 26eb2f761c70036bae3a4ee866adb21e9dd97695
Author: Quentin Rameau <[email protected]>
Date: Sat, 21 Nov 2015 19:53:29 +0100
Add mouse function to play medias in external player
Control + left click launches mpv with the target media url.
Diffstat:
M config.def.h | 8 ++++++++
M surf.c | 12 ++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/config.def.h b/config.def.h
t@@ -65,6 +65,13 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CAS…
} \
}
+/* VIDEOPLAY(URI) */
+#define VIDEOPLAY(u) {\
+ .v = (const char *[]){ "/bin/sh", "-c", \
+ "mpv --really-quiet \"$0\"", u, NULL \
+ } \
+}
+
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
t@@ -142,4 +149,5 @@ static Button buttons[] = {
{ OnLink, MODKEY, 1, clicknewwindow, { .b = 1 }, …
{ OnAny, 0, 8, clicknavigate, { .i = -1 }, …
{ OnAny, 0, 9, clicknavigate, { .i = +1 }, …
+ { OnMedia, MODKEY, 1, clickexternplayer, { 0 }, …
};
diff --git a/surf.c b/surf.c
t@@ -178,6 +178,7 @@ static void find(Client *c, const Arg *a);
/* Buttons */
static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h);
static void clicknewwindow(Client *c, const Arg *a, WebKitHitTestResult *h);
+static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h);
static char winid[64];
static char togglestats[10];
t@@ -1462,6 +1463,17 @@ clicknewwindow(Client *c, const Arg *a, WebKitHitTestRe…
newwindow(c, &arg, a->b);
}
+void
+clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h)
+{
+ Arg arg;
+
+ if (webkit_hit_test_result_get_context(h) & OnMedia) {
+ arg = (Arg)VIDEOPLAY(webkit_hit_test_result_get_media_uri(h));
+ spawn(c, &arg);
+ }
+}
+
int
main(int argc, char *argv[])
{
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.