From 6fa6e0b196b2d54330993be20825a2926b8e1120 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Fri, 6 Jun 2014 02:32:17 +0200
Subject: [PATCH] Write VIMB_URI environment variable.

---
 doc/vimb.1 | 20 +++++++++-----------
 src/main.c |  2 ++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/vimb.1 b/doc/vimb.1
index d3ecb3c..e9b8913 100644
--- a/doc/vimb.1
+++ b/doc/vimb.1
@@ -535,16 +535,14 @@ Removes all entries from queue.
 .SS Misc
 .TP
 .BI ":sh[ellcmd] " CMD
-Runs given shell \fICMD\fP syncron and print the output into inputbox. The
-\fICMD\fP can contain multiple '%' chars that are expanded to the current
-opened URI to input a % this has to be escaped by a '\'. Also the '~/' to home
-dir expansion is available.
+Runs given shell \fICMD\fP syncron and print the output into inputbox.
+Follwing pattern in \fICMD\fP are expanded, '~username', '~/', '$VAR'
+and '${VAR}'. A '\\' before these patterns disables the expansion.
+
+Example: :sh! echo "$VIMB_URI" >> myhistory.txt
 .TP
 .BI ":sh[ellcmd]! " CMD
-Runs given shell \fICMD\fP asyncron. The '%' and '~/' expanshion of the :sh
-command are also expanded for this command too.
-
-Example: :sh! echo "`date` %" >> myhistory.txt
+Like :shellcmd, but asyncron.
 .TP
 .BI ":s[ave] [" PATH "]"
 Download current opened page into configured download directory. If \fIPATH\fP
@@ -910,9 +908,9 @@ File for userdefined css styles. These file is used if the config variable
 .RE
 .SH ENVIRONMENT
 .TP
-.B HOME
-If this is set and not empty this will be used to get the path of the home
-directory. If not set the entry out of the passwd file will be used instead.
+.B VIMB_URI
+This variable is set by vimb everytime a new page is opened to the URI of the
+page.
 .TP
 .B http_proxy
 If this variable is set to an none empty value, and the configuration option
diff --git a/src/main.c b/src/main.c
index f4fb029..495bcfe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -485,6 +485,8 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec)
                 /* save the current uri */
                 g_free(vb.state.uri);
                 g_object_get(view, "uri", &vb.state.uri, NULL);
+                /* export the uri */
+                g_setenv("VIMB_URI", vb.state.uri, true);
 
                 WebKitWebFrame *frame = webkit_web_view_get_main_frame(view);
                 /* set the status */
-- 
2.20.1