]> git.armaanb.net Git - chorizo.git/commitdiff
Optionally write each URI to $LARIZA_HISTORY_FILE
authorPeter Hofmann <scm@uninformativ.de>
Sat, 4 Feb 2017 16:48:40 +0000 (17:48 +0100)
committerPeter Hofmann <scm@uninformativ.de>
Sat, 4 Feb 2017 16:48:40 +0000 (17:48 +0100)
CHANGES
browser.c
man1/lariza.1

diff --git a/CHANGES b/CHANGES
index 7bb3ea55101532bc15a691e38342005f0ca71585..fcadb961967f57604b33b11e95c39ea2bc0941f6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,7 @@ next
     files.
   - Hotkeys have been unified. It is now largely irrelevant whether the
     location bar or the web view has focus.
+  - Lariza can be instructed to write each visited URI to a file.
 
 v16.12  2016-12-24
   [Fixed]
index c71ad56109b9c281e97cb0bc8d38473e229af33f..a4391dc365891549c8e7fd7018590c630fac8d88 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -78,6 +78,7 @@ static gchar *download_dir = "/var/tmp";
 static Window embed = 0;
 static gchar *fifo_suffix = "main";
 static gdouble global_zoom = 1.0;
+static gchar *history_file = NULL;
 static gchar *home_uri = "about:blank";
 static gboolean initial_wc_setup_done = FALSE;
 static GHashTable *keywords = NULL;
@@ -342,9 +343,22 @@ changed_uri(GObject *obj, GParamSpec *pspec, gpointer data)
 {
     const gchar *t;
     struct Client *c = (struct Client *)data;
+    FILE *fp;
 
     t = webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view));
     gtk_entry_set_text(GTK_ENTRY(c->location), (t == NULL ? __NAME__ : t));
+
+    if (t != NULL && history_file != NULL)
+    {
+        fp = fopen(history_file, "a");
+        if (fp != NULL)
+        {
+            fprintf(fp, "%s\n", t);
+            fclose(fp);
+        }
+        else
+            perror(__NAME__": Error opening history file");
+    }
 }
 
 gboolean
@@ -562,6 +576,10 @@ grab_environment_configuration(void)
     if (e != NULL)
         fifo_suffix = g_strdup(e);
 
+    e = g_getenv(__NAME_UPPERCASE__"_HISTORY_FILE");
+    if (e != NULL)
+        history_file = g_strdup(e);
+
     e = g_getenv(__NAME_UPPERCASE__"_HOME_URI");
     if (e != NULL)
         home_uri = g_strdup(e);
index 7db3a5eb474e21d837a1bdca88e6cba6d75aed1b..666af3e1ff3fe3ff71731aefc6348117d474ebb2 100644 (file)
@@ -73,6 +73,11 @@ $\fBUID\fP is the id of your user. $\fBLARIZA_FIFO_SUFFIX\fP defaults to
 \fBmain\fP. If you change this variable, you can launch several
 independent cooperative instances of \fBlariza\fP.
 .TP
+\fBLARIZA_HISTORY_FILE\fP
+If set, \fBlariza\fP will write each visited URI to that file. This path
+can point to a named pipe, but be aware that the browser will block
+until a reader at the other end of the pipe has read all pending data.
+.TP
 \fBLARIZA_HOME_URI\fP
 This URI will be opened by pressing the appropriate hotkeys
 (\(lqhomepage\(rq or \(lqnew window\(rq) and if no URIs are specified on