aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2010-11-29 17:35:43 -0700
committerGravatar Brendan Taylor <whateley@gmail.com>2010-11-29 17:35:43 -0700
commit349252c6d687f5a3852926d81ccf08987c1a09e9 (patch)
tree528bbf791caf41b94712e5bfdf64708f549bca03 /src
parent518004933b6d110d2a6d140f86c759dd4e713607 (diff)
add UZBL_CONFIG, UZBL_PID, UZBL_XID, UZBL_FIFO, UZBL_SOCKT, UZBL_URL and UZBL_TITLE env variables
Diffstat (limited to 'src')
-rw-r--r--src/callbacks.c2
-rw-r--r--src/uzbl-core.c17
2 files changed, 14 insertions, 5 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index f596472..2637810 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -411,6 +411,7 @@ title_change_cb (WebKitWebView* web_view, GParamSpec param_spec) {
uzbl.gui.main_title = title ? g_strdup (title) : g_strdup ("(no title)");
update_title();
send_event(TITLE_CHANGED, uzbl.gui.main_title, NULL);
+ g_setenv("UZBL_TITLE", uzbl.gui.main_title, TRUE);
}
void
@@ -436,6 +437,7 @@ load_status_change_cb (WebKitWebView* web_view, GParamSpec param_spec) {
g_free (uzbl.state.uri);
GString* newuri = g_string_new (webkit_web_frame_get_uri (frame));
uzbl.state.uri = g_string_free (newuri, FALSE);
+ g_setenv("UZBL_URL", uzbl.state.uri, TRUE);
send_event(LOAD_COMMIT, webkit_web_frame_get_uri (frame), NULL);
break;
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index cb20fd7..3a04027 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -1613,8 +1613,9 @@ init_fifo(gchar *dir) { /* return dir or, on error, free dir and return NULL */
if (g_io_add_watch(chan, G_IO_IN|G_IO_HUP, (GIOFunc) control_fifo, NULL)) {
if (uzbl.state.verbose)
printf ("init_fifo: created successfully as %s\n", path);
- send_event(FIFO_SET, path, NULL);
+ send_event(FIFO_SET, path, NULL);
uzbl.comm.fifo_path = path;
+ g_setenv("UZBL_FIFO", uzbl.comm.fifo_path, TRUE);
return dir;
} else g_warning ("init_fifo: could not add watch on %s\n", path);
} else g_warning ("init_fifo: can't open: %s\n", error->message);
@@ -1808,6 +1809,7 @@ init_socket(gchar *dir) { /* return dir or, on error, free dir and return NULL *
g_io_add_watch(chan, G_IO_IN|G_IO_HUP, (GIOFunc) control_socket, chan);
uzbl.comm.socket_path = path;
send_event(SOCKET_SET, path, NULL);
+ g_setenv("UZBL_SOCKET", uzbl.comm.socket_path, TRUE);
return dir;
}
} else g_warning ("init_socket: could not open in %s: %s\n", path, strerror(errno));
@@ -2075,6 +2077,7 @@ settings_init () {
send_event(COMMAND_ERROR, tmp, NULL);
g_free(tmp);
}
+ g_setenv("UZBL_CONFIG", s->config_file, TRUE);
} else if (uzbl.state.verbose)
printf ("No configuration file loaded.\n");
@@ -2357,12 +2360,16 @@ main (int argc, char* argv[]) {
"signal::changed", (GCallback)scroll_horiz_cb, NULL,
NULL);
+ gchar *xwin = g_strdup_printf("%d", (int)uzbl.xwin);
+ g_setenv("UZBL_XID", xwin, TRUE);
+
if(!uzbl.state.instance_name)
- uzbl.state.instance_name = itos((int)uzbl.xwin);
+ uzbl.state.instance_name = g_strdup(xwin);
- GString *tmp = g_string_new("");
- g_string_printf(tmp, "%d", getpid());
- uzbl.info.pid_str = g_string_free(tmp, FALSE);
+ g_free(xwin);
+
+ uzbl.info.pid_str = g_strdup_printf("%d", getpid());
+ g_setenv("UZBL_PID", uzbl.info.pid_str, TRUE);
send_event(INSTANCE_START, uzbl.info.pid_str, NULL);
if(uzbl.state.plug_mode) {