summaryrefslogtreecommitdiff
path: root/config.def.h
diff options
context:
space:
mode:
authorRafael Marçalo <raroma09@gmail.com>2023-11-29 17:37:11 +0000
committerRafael Marçalo <raroma09@gmail.com>2023-11-29 17:37:11 +0000
commit025ce6afa7afacbadb08ec73bd22a9cf3dd7cea1 (patch)
tree997a6ec9d7f4c0f8bd1b1de12e260e8aade59e3a /config.def.h
parent30f5464eb11b96f740b124816cbcfa55f125cf53 (diff)
Websearch patch
Diffstat (limited to 'config.def.h')
-rw-r--r--config.def.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index 93cfeeb..e5f217e 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.
@@ -64,6 +65,7 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
#define PROMPT_GO "Go:"
#define PROMPT_FIND "Find:"
+#define PROMPT_SEARCH "Search:"
/* SETPROP(readprop, setprop, prompt)*/
#define SETPROP(r, s, p) { \
@@ -103,6 +105,15 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
} \
}
+/* SEARCH(searchQuery, prompt) */
+#define SEARCH(s, p) { \
+ .v = (const char *[]){ "/bin/sh", "-c", \
+ "query=\"$(dmenu -p '"p"' -w $1 < /dev/null)\" " \
+ "&& xprop -id $1 -f "s" 8u -set "s" \"$query\"", \
+ "surf-search", winid, "_SURF_SEARCH", NULL \
+ } \
+}
+
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
@@ -134,6 +145,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("_SURF_SEARCH", PROMPT_SEARCH) },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },