summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2017-02-04 17:48:40 +0100
committerPeter Hofmann <scm@uninformativ.de>2017-02-04 17:48:40 +0100
commit2417f006e917286c244a0483a05e7e21597ec1bf (patch)
treeceb078df6808b1cf6be7dee2bbca0c9b6e1eedaa
parent25690854369a6bdf8e5f01da406fd350009ec135 (diff)
downloadlariza-2417f006e917286c244a0483a05e7e21597ec1bf.tar.gz
Optionally write each URI to $LARIZA_HISTORY_FILE
-rw-r--r--CHANGES1
-rw-r--r--browser.c18
-rw-r--r--man1/lariza.15
3 files changed, 24 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 7bb3ea5..fcadb96 100644
--- 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]
diff --git a/browser.c b/browser.c
index c71ad56..a4391dc 100644
--- 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);
diff --git a/man1/lariza.1 b/man1/lariza.1
index 7db3a5e..666af3e 100644
--- a/man1/lariza.1
+++ b/man1/lariza.1
@@ -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