This variable is set by vimb everytime a new page is opened to the URI of the
page.
.TP
+.B VIMB_TITLE
+Contains the title of the current opened page.
+.TP
+.B VIMB_PID
+Contains the pid of the running vimb instance.
+.TP
+.B VIMB_XID
+Holds the X-Window id of the vim window or of the embedding window if vimb is
+started with -e option.
+.TP
.B http_proxy
If this variable is set to an none empty value, and the configuration option
`proxy' is enabled, this will be used as http proxy.
#include "config.h"
#include <stdio.h>
#include <sys/stat.h>
+#include <unistd.h>
+#include <gdk/gdkx.h>
#include "main.h"
#include "util.h"
#include "command.h"
static void init_core(void)
{
Gui *gui = &vb.gui;
+ char *xid;
if (vb.embed) {
gui->window = gtk_plug_new(vb.embed);
+ xid = g_strdup_printf("%u", (int)vb.embed);
} else {
+
gui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
#ifdef HAS_GTK3
gtk_window_set_has_resize_grip(GTK_WINDOW(gui->window), false);
#endif
gtk_window_set_wmclass(GTK_WINDOW(gui->window), PROJECT, PROJECT_UCFIRST);
gtk_window_set_role(GTK_WINDOW(gui->window), PROJECT_UCFIRST);
+
+ gtk_widget_realize(GTK_WIDGET(gui->window));
+
+ /* set the x window id to env */
+ xid = g_strdup_printf("%d", (int)GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(gui->window))));
}
+ g_setenv("VIMB_XID", xid, true);
+ g_free(xid);
+
GdkGeometry hints = {10, 10};
gtk_window_set_default_size(GTK_WINDOW(gui->window), WIN_WIDTH, WIN_HEIGHT);
gtk_window_set_title(GTK_WINDOW(gui->window), PROJECT "/" VERSION);
{
OVERWRITE_STRING(vb.state.title, title);
update_title();
+ g_setenv("VIMB_TITLE", title ? title : "", true);
}
static void update_title(void)
static char *winid = NULL;
static gboolean ver = false;
static GError *err;
+ char *pid;
static GOptionEntry opts[] = {
{"cmd", 'C', 0, G_OPTION_ARG_STRING, &vb.config.autocmd, "Ex command run before first page is loaded", NULL},
vb.embed = strtol(winid, NULL, 0);
}
+ pid = g_strdup_printf("%d", getpid());
+ g_setenv("VIMB_PID", pid, true);
+ g_free(pid);
+
init_core();
/* process the --cmd if this was given */