]> git.armaanb.net Git - chorizo.git/commitdiff
Introduce $LARIZA_HOME_URI
authorPeter Hofmann <scm@uninformativ.de>
Thu, 10 Jul 2014 16:56:44 +0000 (18:56 +0200)
committerPeter Hofmann <scm@uninformativ.de>
Thu, 10 Jul 2014 16:56:44 +0000 (18:56 +0200)
As suggested by @okraits in #2.

README
browser.c

diff --git a/README b/README
index f89e5cdd8995cabc3993b8e9a58c1727890d22bc..994c03f7e145a13cbd1b0fa2383577d9738588ca 100644 (file)
--- a/README
+++ b/README
@@ -96,8 +96,8 @@ Main windows
             Close the current window.
 
         Mod1 + w
-            Go to your "homepage" which is the first URI specified on
-            the command line.
+            Go to your "homepage". See the environment variable
+            $LARIZA_HOME_URI.
 
         Mod1 + e
             Open a new window.
@@ -196,7 +196,7 @@ following options:
         Disables automatic launching of suckless' tabbed.
 
 After these options there can be any number of URIs. If no URIs are
-given, about:blank will be opened.
+given, $LARIZA_HOME_URI will be opened.
 
 
 =====================
@@ -225,6 +225,11 @@ following environment variables:
         "main". If you change this variable, you can launch several
         independent cooperative instances of lariza.
 
+    LARIZA_HOME_URI
+        This URI will be opened by pressing the appropriate hotkeys
+        ("homepage" or "new window") and if no URIs are specified on the
+        command line. Defaults to "about:blank".
+
     LARIZA_ZOOM
         Zoom level for WebKit viewports. Defaults to 1.0.
 
index 1c7155ca373909806be715c1337eb727af1524db..4fc6b71e9994c2cff7ac9170d2258f013a532ee4 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -76,8 +76,8 @@ static gchar *download_dir = "/tmp";
 static gint downloads_indicated = 0;
 static Window embed = 0;
 static gchar *fifo_suffix = "main";
-static gchar *first_uri = "about:blank";
 static gdouble global_zoom = 1.0;
+static gchar *home_uri = "about:blank";
 static GHashTable *keywords = NULL;
 static gboolean language_is_set = FALSE;
 static gchar *search_text = NULL;
@@ -565,6 +565,10 @@ grab_environment_configuration(void)
        if (e != NULL)
                fifo_suffix = g_strdup(e);
 
+       e = g_getenv(__NAME_UPPERCASE__"_HOME_URI");
+       if (e != NULL)
+               home_uri = g_strdup(e);
+
        e = g_getenv(__NAME_UPPERCASE__"_ZOOM");
        if (e != NULL)
                global_zoom = atof(e);
@@ -688,14 +692,14 @@ key_web_view(GtkWidget *widget, GdkEvent *event, gpointer data)
                                        gtk_widget_destroy(c->win);
                                        return TRUE;
                                case GDK_KEY_w:  /* home (left hand) */
-                                       f = ensure_uri_scheme(first_uri);
+                                       f = ensure_uri_scheme(home_uri);
                                        if (show_all_requests)
                                                fprintf(stderr, "====> %s\n", f);
                                        webkit_web_view_load_uri(WEBKIT_WEB_VIEW(c->web_view), f);
                                        g_free(f);
                                        return TRUE;
                                case GDK_KEY_e:  /* new tab (left hand) */
-                                       f = ensure_uri_scheme(first_uri);
+                                       f = ensure_uri_scheme(home_uri);
                                        if (show_all_requests)
                                                fprintf(stderr, "====> %s\n", f);
                                        client_new(f);
@@ -970,10 +974,9 @@ main(int argc, char **argv)
                embed = tabbed_launch();
 
        if (optind >= argc)
-               client_new(first_uri);
+               client_new(home_uri);
        else
        {
-               first_uri = g_strdup(argv[optind]);
                for (i = optind; i < argc; i++)
                        client_new(argv[i]);
        }