summaryrefslogtreecommitdiff
path: root/surf/patches/surf-spacesearch-20170408-b814567.diff
blob: ad5c0feb687c95c5e646acf636e68a38e95e25ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff --git a/config.def.h b/config.def.h
index 6d3135e..75dc6a6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -153,6 +153,8 @@ static Key keys[] = {
 	{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m,      toggle,     { .i = Style } },
 };
 
+static char *searchengine = "https://duckduckgo.com/?q=";
+
 /* button definitions */
 /* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
 static Button buttons[] = {
diff --git a/surf.c b/surf.c
index 93a1629..c20537e 100644
--- a/surf.c
+++ b/surf.c
@@ -476,6 +476,8 @@ loaduri(Client *c, const Arg *a)
 	} else if (!stat(uri, &st) && (path = realpath(uri, NULL))) {
 		url = g_strdup_printf("file://%s", path);
 		free(path);
+	} else if (*uri == ' ') {
+		url = g_strdup_printf("%s%s", searchengine, uri + 1);
 	} else {
 		url = g_strdup_printf("http://%s", uri);
 	}