summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-05-17 13:02:48 +0300
committerCem Keylan <cem@ckyln.com>2021-05-17 13:04:14 +0300
commit37732e7810f68d02e4b9c98a00e3787eb1b5e368 (patch)
tree7f61558857ce8be02da9f702af303f2452270095
parent966832f446e84cd7a202cf037a3c3f041c0ba1c5 (diff)
downloadlariza-37732e7810f68d02e4b9c98a00e3787eb1b5e368.tar.gz
add search engine support
-rw-r--r--browser.c9
-rw-r--r--config.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/browser.c b/browser.c
index ebab7fb..fc2d12a 100644
--- a/browser.c
+++ b/browser.c
@@ -12,6 +12,7 @@
#include <gio/gio.h>
#include <webkit2/webkit2.h>
#include <JavaScriptCore/JavaScript.h>
+#include "config.h"
void client_destroy(GtkWidget *, gpointer);
@@ -643,8 +644,12 @@ ensure_uri_scheme(const gchar *t)
f = g_strdup_printf("file://%s", fabs);
free(fabs);
}
- else
- f = g_strdup_printf("http://%s", t);
+ else {
+ if (g_str_has_prefix(f, "!/"))
+ f = g_strdup_printf(SEARCH_ENGINE, t + 2);
+ else
+ f = g_strdup_printf("http://%s", t);
+ }
return f;
}
else
diff --git a/config.h b/config.h
new file mode 100644
index 0000000..454463f
--- /dev/null
+++ b/config.h
@@ -0,0 +1,2 @@
+/* Configuration file for lariza */
+#define SEARCH_ENGINE "https://duckduckgo.com/?q=%s"