diff options
| author | stkhan <personal@slickd.xyz> | 2022-04-21 17:15:27 -0500 |
|---|---|---|
| committer | stkhan <personal@slickd.xyz> | 2022-04-21 17:15:27 -0500 |
| commit | 6d5f8c137608df2e459c9865efa19c72856ed6e8 (patch) | |
| tree | bde7ebb7e20ac737d10c25b6503228395645a8db /surf/patches | |
| parent | df966cab682c913e8b62b460c9ef900e1046863f (diff) | |
added stuff:
Diffstat (limited to 'surf/patches')
| -rw-r--r-- | surf/patches/surf-2.0-homepage.diff | 24 | ||||
| -rw-r--r-- | surf/patches/surf-2.1-history.diff | 68 | ||||
| -rw-r--r-- | surf/patches/surf-bookmarks-20170722-723ff26.diff | 42 | ||||
| -rw-r--r-- | surf/patches/surf-short-title-20210206-7dcce9e.diff | 115 |
4 files changed, 249 insertions, 0 deletions
diff --git a/surf/patches/surf-2.0-homepage.diff b/surf/patches/surf-2.0-homepage.diff new file mode 100644 index 0000000..f32016f --- /dev/null +++ b/surf/patches/surf-2.0-homepage.diff @@ -0,0 +1,24 @@ +diff --git a/config.def.h b/config.def.h +--- a/config.def.h ++++ b/config.def.h +@@ -164,3 +164,5 @@ static Button buttons[] = { + { OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 }, + { OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 }, + }; ++ ++#define HOMEPAGE "https://duckduckgo.com/" +diff --git a/surf.c b/surf.c +--- a/surf.c ++++ b/surf.c +@@ -1751,7 +1751,11 @@ main(int argc, char *argv[]) + if (argc > 0) + arg.v = argv[0]; + else ++#ifdef HOMEPAGE ++ arg.v = HOMEPAGE; ++#else + arg.v = "about:blank"; ++#endif + + setup(); + c = newclient(NULL); diff --git a/surf/patches/surf-2.1-history.diff b/surf/patches/surf-2.1-history.diff new file mode 100644 index 0000000..453750d --- /dev/null +++ b/surf/patches/surf-2.1-history.diff @@ -0,0 +1,68 @@ +diff --git a/config.def.h b/config.def.h +index b6ae4fc..74b1968 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -6,6 +6,8 @@ static char *styledir = "~/.surf/styles/"; + static char *certdir = "~/.surf/certificates/"; + static char *cachedir = "~/.surf/cache/"; + static char *cookiefile = "~/.surf/cookies.txt"; ++static char *historyfile = "~/.surf/history.txt"; ++ + + /* Webkit default features */ + /* Highest priority value will be used. +diff --git a/surf.c b/surf.c +index e709f35..d7c2166 100644 +--- a/surf.c ++++ b/surf.c +@@ -347,9 +347,10 @@ setup(void) + curconfig = defconfig; + + /* dirs and files */ +- cookiefile = buildfile(cookiefile); +- scriptfile = buildfile(scriptfile); +- certdir = buildpath(certdir); ++ cookiefile = buildfile(cookiefile); ++ historyfile = buildfile(historyfile); ++ scriptfile = buildfile(scriptfile); ++ certdir = buildpath(certdir); + if (curconfig[Ephemeral].val.i) + cachedir = NULL; + else +@@ -589,6 +590,7 @@ loaduri(Client *c, const Arg *a) + } else { + webkit_web_view_load_uri(c->view, url); + updatetitle(c); ++ updatehistory(url); + } + + g_free(url); +@@ -659,6 +661,20 @@ updatetitle(Client *c) + } + } + ++void ++updatehistory(const char *url) ++{ ++ FILE *f; ++ f = fopen(historyfile, "a+"); ++ ++ char timestamp[20]; ++ time_t now = time (0); ++ strftime (timestamp, 20, "%Y-%m-%dT%H:%M:%S", localtime (&now)); ++ ++ fprintf(f, "%s %s\n", timestamp, url); ++ fclose(f); ++} ++ + void + gettogglestats(Client *c) + { +@@ -1085,6 +1101,7 @@ cleanup(void) + close(spair[0]); + close(spair[1]); + g_free(cookiefile); ++ g_free(historyfile); + g_free(scriptfile); + g_free(stylefile); + g_free(cachedir); diff --git a/surf/patches/surf-bookmarks-20170722-723ff26.diff b/surf/patches/surf-bookmarks-20170722-723ff26.diff new file mode 100644 index 0000000..323ba55 --- /dev/null +++ b/surf/patches/surf-bookmarks-20170722-723ff26.diff @@ -0,0 +1,42 @@ +diff --git a/config.def.h b/config.def.h +index 2e735bf..43ad9ab 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -69,8 +69,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 ~/.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 \ + } \ + } +@@ -101,6 +102,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 ~/.surf/bookmarks) " \ ++ "| awk '!seen[$0]++' > ~/.surf/bookmarks.tmp && " \ ++ "mv ~/.surf/bookmarks.tmp ~/.surf/bookmarks", \ ++ winid, r, NULL \ ++ } \ ++} ++ + /* styles */ + /* + * The iteration will stop at the first match, beginning at the beginning of +@@ -132,6 +144,7 @@ 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_m, spawn, BM_ADD("_SURF_URI") }, + + { 0, GDK_KEY_Escape, stop, { 0 } }, + { MODKEY, GDK_KEY_c, stop, { 0 } }, diff --git a/surf/patches/surf-short-title-20210206-7dcce9e.diff b/surf/patches/surf-short-title-20210206-7dcce9e.diff new file mode 100644 index 0000000..4a0a8a4 --- /dev/null +++ b/surf/patches/surf-short-title-20210206-7dcce9e.diff @@ -0,0 +1,115 @@ +From d5437333d64ff5eb7aaab19e4d42b11d6773a7b0 Mon Sep 17 00:00:00 2001 +From: Harsh Parekh <harsh_parekh@outlook.com> +Date: Sat, 6 Feb 2021 08:33:49 -0500 +Subject: [PATCH] Hide status from title. + +You can pass -E 1 to show the extended title. +--- + config.def.h | 2 ++ + surf.1 | 7 +++++++ + surf.c | 31 ++++++++++++++++++++++++------- + 3 files changed, 33 insertions(+), 7 deletions(-) + +diff --git a/config.def.h b/config.def.h +index be168ab..2783e4d 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -1,5 +1,6 @@ + /* modifier 0 means no modifier */ + static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */ ++static int extendedtitle = 0; /* 0 to not append surf's toggle and page status to title. */ + static char *fulluseragent = ""; /* Or override the whole user agent string */ + static char *scriptfile = "~/.surf/script.js"; + static char *styledir = "~/.surf/styles/"; +@@ -176,6 +177,7 @@ static Key keys[] = { + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } }, + { 0, GDK_KEY_F11, togglefullscreen, { 0 } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } }, ++ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_e, toggletitle, { 0 } }, + + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } }, +diff --git a/surf.1 b/surf.1 +index 45c31bb..0e15c61 100644 +--- a/surf.1 ++++ b/surf.1 +@@ -55,6 +55,13 @@ Enable the disk cache. + Reparents to window specified by + .IR xid . + .TP ++.B \-E [1|0] ++Show or hide ++.I indicators of operation ++and ++.I indicators of web page ++in the title. ++.TP + .B \-f + Start surf in windowed mode (not fullscreen). + .TP +diff --git a/surf.c b/surf.c +index ac832ff..bca0b91 100644 +--- a/surf.c ++++ b/surf.c +@@ -234,6 +234,7 @@ static void toggle(Client *c, const Arg *a); + 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 toggletitle(Client *c, const Arg *a); + static void find(Client *c, const Arg *a); + + /* Buttons */ +@@ -649,13 +650,19 @@ updatetitle(Client *c) + gettogglestats(c); + getpagestats(c); + +- if (c->progress != 100) +- title = g_strdup_printf("[%i%%] %s:%s | %s", +- c->progress, togglestats, pagestats, name); +- else +- title = g_strdup_printf("%s:%s | %s", +- togglestats, pagestats, name); +- ++ if (c->progress != 100) { ++ if (!extendedtitle) ++ title = g_strdup_printf("[%i%%] %s", c->progress, name); ++ else ++ title = g_strdup_printf("[%i%%] %s:%s | %s", ++ c->progress, togglestats, pagestats, name); ++ } else { ++ if (!extendedtitle) ++ title = g_strdup_printf("%s", name); ++ else ++ title = g_strdup_printf("%s:%s | %s", ++ togglestats, pagestats, name); ++ } + gtk_window_set_title(GTK_WINDOW(c->win), title); + g_free(title); + } else { +@@ -1953,6 +1960,13 @@ toggleinspector(Client *c, const Arg *a) + webkit_web_inspector_show(c->inspector); + } + ++void ++toggletitle(Client *c, const Arg *a) ++{ ++ extendedtitle = !extendedtitle; ++ updatetitle(c); ++} ++ + void + find(Client *c, const Arg *a) + { +@@ -2042,6 +2056,9 @@ main(int argc, char *argv[]) + case 'e': + embed = strtol(EARGF(usage()), NULL, 0); + break; ++ case 'E': ++ extendedtitle = strtol(EARGF(usage()), NULL, 0); ++ break; + case 'f': + defconfig[RunInFullscreen].val.i = 0; + defconfig[RunInFullscreen].prio = 2; +-- +2.30.0 + |