tAdd bindings to send URI to plumb or firefox - surf - customized build of surf… | |
git clone git://src.adamsgaard.dk/surf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 8351fce81bead5a71962e7e87908b1a898cccc00 | |
parent 90c835416e14473f0d3931df14f3e9ce6e24e829 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Fri, 14 Feb 2020 19:59:55 +0100 | |
Add bindings to send URI to plumb or firefox | |
Diffstat: | |
M config.def.h | 2 +- | |
M config.h | 19 ++++++++++++++++++- | |
M surf.c | 3 ++- | |
3 files changed, 21 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/config.def.h b/config.def.h | |
t@@ -91,7 +91,7 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE… | |
*/ | |
#define PLUMB(u) {\ | |
.v = (const char *[]){ "/bin/sh", "-c", \ | |
- "xdg-open \"$0\"", u, NULL \ | |
+ "plumb \"$0\"", u, NULL \ | |
} \ | |
} | |
diff --git a/config.h b/config.h | |
t@@ -95,6 +95,14 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CAS… | |
} \ | |
} | |
+/* PLUMBER(URI) */ | |
+#define PLUMBER(u) {\ | |
+ .v = (const char *[]){ "/bin/sh", "-c", \ | |
+ "plumb \"$(echo $(xprop -id $0 $1 | cut -d '\"' -f2) )\"",\ | |
+ winid, u, NULL \ | |
+ } \ | |
+} | |
+ | |
/* VIDEOPLAY(URI) */ | |
#define VIDEOPLAY(u) {\ | |
.v = (const char *[]){ "/bin/sh", "-c", \ | |
t@@ -112,6 +120,14 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_C… | |
} \ | |
} | |
+/* FIREFOX(URI) */ | |
+#define FIREFOX(u) {\ | |
+ .v = (const char *[]){ "/bin/sh", "-c", \ | |
+ "firefox \"$(echo $(xprop -id $0 $1 | cut -d '\"' -f2) )\"",\ | |
+ winid, u, NULL \ | |
+ } \ | |
+} | |
+ | |
/* styles */ | |
/* | |
* The iteration will stop at the first match, beginning at the beginning of | |
t@@ -142,6 +158,7 @@ static Key keys[] = { | |
/* modifier keyval function arg */ | |
{ MODKEY, GDK_KEY_o, spawn, SETPROP("_SURF_UR… | |
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FI… | |
+ { MODKEY, GDK_KEY_f, spawn, FIREFOX("_SURF_UR… | |
{ 0, GDK_KEY_Escape, stop, { 0 } }, | |
{ MODKEY, GDK_KEY_c, stop, { 0 } }, | |
t@@ -160,7 +177,7 @@ static Key keys[] = { | |
{ MODKEY, GDK_KEY_d, scrollv, { .i = +50 } }, | |
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_d, scrollv, { .i = +100 } }, | |
{ MODKEY, GDK_KEY_u, scrollv, { .i = -50 } }, | |
- { MODKEY|GDK_SHIFT_MASK, GDK_KEY_u, scrollv, { .i = -100 } }, | |
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_u, spawn, PLUMBER("_SURF_UR… | |
{ MODKEY, GDK_KEY_i, scrollh, { .i = +10 } }, | |
diff --git a/surf.c b/surf.c | |
t@@ -1981,10 +1981,11 @@ main(int argc, char *argv[]) | |
Arg arg; | |
Client *c; | |
-#ifdef __OpenBSD__ | |
+#ifdef __aOpenBSD__ | |
char path[128]; | |
const char* home = getcurrentuserhomedir(); | |
+ /* in new X session: surf doesn't start until another X program has ru… | |
if (snprintf(path, sizeof(path), "%s/.cache", home) < 0) | |
err(1, "snprintf"); | |
if (unveil(path, "rwc") == -1) |