commit 107fe086707b94e94990f2b83d83d13c47c3e32c
parent cc235f4365573475a2244b7aa1dc189f2ca8c604
Author: Mahdi Mirzade <[email protected]>
Date: Mon, 6 Jun 2022 14:31:14 +0430
Fix dark mode; Fix if history/bookmark files doesn't exist
Diffstat:
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/config.h b/config.h
@@ -36,7 +36,7 @@ static Parameter defconfig[ParameterLast] = {
[Certificate] = { { .i = 0 }, },
[CaretBrowsing] = { { .i = 0 }, },
[CookiePolicies] = { { .v = "@Aa" }, },
- [DarkMode] = { { .i = 1 }, },
+ [DarkMode] = { { .i = 1 }, },
[DefaultCharset] = { { .v = "UTF-8" }, },
[DiskCache] = { { .i = 1 }, },
[DNSPrefetch] = { { .i = 0 }, },
@@ -94,7 +94,7 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
#define SETPROP(r, s, p) { \
.v = (const char *[]){ "/bin/sh", "-c", \
"WIDTH=\"$(xwininfo -id $1 | awk '/Width/{print int($2/5/3)}')\"; " \
- "HIST=\"$(tac " HS_FILE " | awk -F'|' '!a[$2]++')\"; " \
+ "HIST=\"$(tac " HS_FILE " 2>/dev/null | awk -F'|' '!a[$2]++')\"; " \
"if [ \"${WIDTH}\" -lt 30 ]; then " \
" HIST_TABLE=\"$(printf '%s\n' \"${HIST}\" | awk -F'|' '{print NR\"|\"$3}')\";" \
"elif [ \"${WIDTH}\" -lt 50 ]; then" \
@@ -104,7 +104,7 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
"| sed -e 's/^"r"(UTF8_STRING) = \"\\(.*\\)\"/\\1/' " \
" -e 's/\\\\\\(.\\)/\\1/g' "\
" && [ \""p"\" != \""PROMPT_FIND"\" ]" \
- " && cat " BM_FILE " " \
+ " && cat " BM_FILE " 2>/dev/null " \
" && printf '%s\n' \"${HIST_TABLE}\" | column -t -s '|' -o ' ')\" " \
"| dmenu -i -b -l 20 -p '"p"' -w $1 | awk '{if(length($3)!=0){print $1}else{print $0}}')\"; " \
"[ \"$prop\" ] || exit; " \
diff --git a/surf.1 b/surf.1
@@ -209,7 +209,7 @@ Toggle scrollbars. This will reload the page.
Toggle caret browsing. This will reload the page.
.TP
.B Ctrl\-Shift\-d
-Toggle dark mode. This will reload the page.
+Toggle dark mode.
.TP
.B Ctrl\-Shift\-i
Toggle auto-loading of images. This will reload the page.
diff --git a/surf.c b/surf.c
@@ -886,7 +886,6 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a)
g_object_set(gtk_settings_get_default(),
"gtk-application-prefer-dark-theme", a->i, NULL);
return;
- break;
case DiskCache:
webkit_web_context_set_cache_model(c->context, a->i ?
WEBKIT_CACHE_MODEL_WEB_BROWSER :