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