summaryrefslogtreecommitdiff
path: root/surf/config.h
diff options
context:
space:
mode:
authorstkhan <personal@slickd.xyz>2022-05-17 18:17:07 +0000
committerstkhan <personal@slickd.xyz>2022-05-17 18:17:07 +0000
commit9261c7a8a339056c3cd58e0b8979a6f25ea764e5 (patch)
treed83fba0566ab0d1c22cac2d84166dcdf4f2d982f /surf/config.h
parentecf6c90d32260530c8f1805d98ff17c4d4693856 (diff)
dwm launches ncmpcpp with pictures, and surf was rebuild
Diffstat (limited to 'surf/config.h')
-rw-r--r--surf/config.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/surf/config.h b/surf/config.h
index 4c824b1..22dca0d 100644
--- a/surf/config.h
+++ b/surf/config.h
@@ -8,7 +8,7 @@ static char *certdir = "~/.config/surf/certificates/";
static char *cachedir = "~/.config/surf/cache/";
static char *cookiefile = "~/.config/surf/cookies.txt";
static char *historyfile = "~/.config/surf/history.txt";
-static char *searchurl = "duckduckgo.com/?q=%s";
+static char *searchurl = "duckduckgo.com/?q=%s";
/* Webkit default features */
/* Highest priority value will be used.
@@ -24,7 +24,6 @@ static Parameter defconfig[ParameterLast] = {
[CaretBrowsing] = { { .i = 0 }, },
[CookiePolicies] = { { .v = "@Aa" }, },
[DefaultCharset] = { { .v = "UTF-8" }, },
- [DarkMode] = { { .i = 0 } },
[DiskCache] = { { .i = 1 }, },
[DNSPrefetch] = { { .i = 0 }, },
[Ephemeral] = { { .i = 0 }, },
@@ -72,8 +71,9 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
#define SETPROP(r, s, p) { \
.v = (const char *[]){ "/bin/sh", "-c", \
"prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
- "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \
- "| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
+ "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\" && cat ~/.config/surf/bookmarks)\" " \
+ "| dmenu -l 10 -p \"$4\" -w $1)\" && " \
+ "xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
"surf-setprop", winid, r, s, p, NULL \
} \
}
@@ -86,11 +86,6 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
} \
}
-#define SETURI(p) {.v = (char *[]){ "/bin/sh", "-c", \
- "prop=\"`tac ~/.config/surf/history.txt | sed 's/^[^ *]* //' | sort -u | dmenu -l 10 -i | cut -d ' ' -f 3`\" &&" \
- "xprop -id $1 -f $0 8s -set $0 \"$prop\"", \
- p, winid, NULL } }
-
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(u, r) { \
.v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
@@ -117,6 +112,17 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
} \
}
+/* BM_ADD(readprop) */
+#define BM_ADD(r) {\
+ .v = (const char *[]){ "/bin/sh", "-c", \
+ "(echo $(xprop -id $0 $1) | cut -d '\"' -f2 " \
+ "| sed 's/.*https*:\\/\\/\\(www\\.\\)\\?//' && cat ~/.config/surf/bookmarks) " \
+ "| awk '!seen[$0]++' > ~/.config/surf/bookmarks.tmp && " \
+ "mv ~/.config/surf/bookmarks.tmp ~/.config/surf/bookmarks", \
+ winid, r, NULL \
+ } \
+}
+
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
@@ -125,7 +131,6 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
static SiteSpecific styles[] = {
/* regexp file in $styledir */
{ ".*", "default.css" },
- { "www.duckduckgo.com*", "ddg.css" },
};
/* certificates */
@@ -149,8 +154,9 @@ static Key keys[] = {
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
- { MODKEY, GDK_KEY_e, spawn, SETURI("_SURF_GO") },
- { MODKEY, GDK_KEY_s, spawn, SEARCH() },
+ { MODKEY, GDK_KEY_m, spawn, BM_ADD("_SURF_URI") },
+ { MODKEY, GDK_KEY_s, spawn, SEARCH() },
+
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },
@@ -196,7 +202,6 @@ static Key keys[] = {
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
- { MODKEY|GDK_SHIFT_MASK, GDK_KEY_d, toggle, { .i = DarkMode } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
};