From f53e4865da54b1f9fd13b575dd0f39054614fdb6 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Wed, 29 Sep 2021 10:58:39 +0300 Subject: LARIZA_SEARCH_ENGINE: add optional environment variable --- browser.c | 7 ++++++- man1/lariza.1 | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/browser.c b/browser.c index b47bdeb..3c58152 100644 --- a/browser.c +++ b/browser.c @@ -91,6 +91,7 @@ gboolean cooperative_alone = TRUE; gboolean cooperative_instances = TRUE; int cooperative_pipe_fp = 0; gchar *download_dir = "/var/tmp"; +gchar *search_engine = SEARCH_ENGINE; gboolean enable_console_to_stdout = FALSE; gchar *fifo_suffix = "main"; gdouble global_zoom = 1.0; @@ -670,7 +671,7 @@ ensure_uri_scheme(const gchar *t) } else { if (g_str_has_prefix(f, "!/")) - f = g_strdup_printf(SEARCH_ENGINE, t + 2); + f = g_strdup_printf(search_engine, t + 2); else f = g_strdup_printf("http://%s", t); } @@ -707,6 +708,10 @@ grab_environment_configuration(void) if (e != NULL) download_dir = g_strdup(e); + e = g_getenv(__NAME_UPPERCASE__"_SEARCH_ENGINE"); + if (e != NULL) + search_engine = g_strdup(e); + e = g_getenv(__NAME_UPPERCASE__"_ENABLE_CONSOLE_TO_STDOUT"); if (e != NULL) enable_console_to_stdout = TRUE; diff --git a/man1/lariza.1 b/man1/lariza.1 index df15c9b..a1b6b31 100644 --- a/man1/lariza.1 +++ b/man1/lariza.1 @@ -70,6 +70,13 @@ This URI will be opened by pressing the appropriate hokeys .Pq Do homepage Dc or Do new window Dc and if no URIs are specified on the command line. Defaults to .Sy about:blank . +.It Sy LARIZA_SEARCH_ENGINE +This URI will be used to format the given search. The URI must contain a +.Sq %s +so that the search can be formatted. This option can also be changed from the +.Pa config.h +file during compilation time. Defaults to +.Lk https://duckduckgo.com/?q=%s .It Sy LARIZA_TAB_POS Can be one of .Sy top -- cgit v1.2.3