diff options
Diffstat (limited to 'utils/surf/patch')
| -rw-r--r-- | utils/surf/patch/surf-2.0-homepage.diff | 24 | ||||
| -rw-r--r-- | utils/surf/patch/surf-2.1-history.diff | 68 | ||||
| -rw-r--r-- | utils/surf/patch/surf-bookmarks-20170722-723ff26.diff | 42 | ||||
| -rw-r--r-- | utils/surf/patch/surf-short-title-20210206-7dcce9e.diff | 115 | ||||
| -rw-r--r-- | utils/surf/patch/surf-websearch-20190510-d068a38.diff | 107 |
5 files changed, 356 insertions, 0 deletions
diff --git a/utils/surf/patch/surf-2.0-homepage.diff b/utils/surf/patch/surf-2.0-homepage.diff new file mode 100644 index 0000000..f32016f --- /dev/null +++ b/utils/surf/patch/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/utils/surf/patch/surf-2.1-history.diff b/utils/surf/patch/surf-2.1-history.diff new file mode 100644 index 0000000..453750d --- /dev/null +++ b/utils/surf/patch/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/utils/surf/patch/surf-bookmarks-20170722-723ff26.diff b/utils/surf/patch/surf-bookmarks-20170722-723ff26.diff new file mode 100644 index 0000000..323ba55 --- /dev/null +++ b/utils/surf/patch/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/utils/surf/patch/surf-short-title-20210206-7dcce9e.diff b/utils/surf/patch/surf-short-title-20210206-7dcce9e.diff new file mode 100644 index 0000000..4a0a8a4 --- /dev/null +++ b/utils/surf/patch/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 + diff --git a/utils/surf/patch/surf-websearch-20190510-d068a38.diff b/utils/surf/patch/surf-websearch-20190510-d068a38.diff new file mode 100644 index 0000000..7e7f92a --- /dev/null +++ b/utils/surf/patch/surf-websearch-20190510-d068a38.diff @@ -0,0 +1,107 @@ +From c5ca896c5ba969b90f1e098d117c205a9b71d0db Mon Sep 17 00:00:00 2001 +From: Bryon Meinka <bryon.meinka@gmail.com> +Date: Sat, 11 May 2019 00:52:29 -0400 +Subject: [PATCH] Web Search + +--- + config.def.h | 10 ++++++++++ + surf.c | 20 +++++++++++++++++++- + 2 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/config.def.h b/config.def.h +index 34265f6..69657bf 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -6,6 +6,7 @@ static char *styledir = "~/.surf/styles/"; + static char *certdir = "~/.surf/certificates/"; + static char *cachedir = "~/.surf/cache/"; + static char *cookiefile = "~/.surf/cookies.txt"; ++static char *searchurl = "duckduckgo.com/?q=%s"; + + /* Webkit default features */ + /* Highest priority value will be used. +@@ -76,6 +77,14 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE | + } \ + } + ++#define SEARCH() { \ ++ .v = (const char *[]){ "/bin/sh", "-c", \ ++ "xprop -id $1 -f $2 8s -set $2 \"" \ ++ "$(dmenu -p Search: -w $1 < /dev/null)\"", \ ++ "surf-search", winid, "_SURF_SEARCH", NULL \ ++ } \ ++} ++ + /* DOWNLOAD(URI, referer) */ + #define DOWNLOAD(u, r) { \ + .v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\ +@@ -133,6 +142,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_s, spawn, SEARCH() }, + + { 0, GDK_KEY_Escape, stop, { 0 } }, + { MODKEY, GDK_KEY_c, stop, { 0 } }, +diff --git a/surf.c b/surf.c +index 2b54e3c..077fb76 100644 +--- a/surf.c ++++ b/surf.c +@@ -35,7 +35,7 @@ + #define LENGTH(x) (sizeof(x) / sizeof(x[0])) + #define CLEANMASK(mask) (mask & (MODKEY|GDK_SHIFT_MASK)) + +-enum { AtomFind, AtomGo, AtomUri, AtomLast }; ++enum { AtomFind, AtomSearch, AtomGo, AtomUri, AtomLast }; + + enum { + OnDoc = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT, +@@ -231,6 +231,7 @@ 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 find(Client *c, const Arg *a); ++static void search(Client *c, const Arg *a); + + /* Buttons */ + static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h); +@@ -326,6 +327,7 @@ setup(void) + + /* atoms */ + atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False); ++ atoms[AtomSearch] = XInternAtom(dpy, "_SURF_SEARCH", False); + atoms[AtomGo] = XInternAtom(dpy, "_SURF_GO", False); + atoms[AtomUri] = XInternAtom(dpy, "_SURF_URI", False); + +@@ -577,6 +579,19 @@ loaduri(Client *c, const Arg *a) + g_free(url); + } + ++void ++search(Client *c, const Arg *a) ++{ ++ Arg arg; ++ char *url; ++ ++ url = g_strdup_printf(searchurl, a->v); ++ arg.v = url; ++ loaduri(c, &arg); ++ ++ g_free(url); ++} ++ + const char * + geturi(Client *c) + { +@@ -1311,6 +1326,9 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) + find(c, NULL); + + return GDK_FILTER_REMOVE; ++ } else if (ev->atom == atoms[AtomSearch]) { ++ a.v = getatom(c, AtomSearch); ++ search(c, &a); + } else if (ev->atom == atoms[AtomGo]) { + a.v = getatom(c, AtomGo); + loaduri(c, &a); +-- +2.21.0 + |