summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2021-01-25 22:51:40 +0100
committerDaniel Carl <danielcarl@gmx.de>2021-01-25 22:51:40 +0100
commit55fb9cc58a1c8fc675b2df4a10e0f99b264f4a40 (patch)
treee40af2d7d88063ebc1c4d2a87d21f90981e67459
parent1255049e514dadfc151713b5f0b93e00ad5f3db2 (diff)
Add new env VIMB_WIN_ID to hold the gtk window id.
Fixes #658.
-rw-r--r--CHANGELOG.md1
-rw-r--r--doc/vimb.13
-rw-r--r--src/main.c18
3 files changed, 14 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9eafcfc..0674e71 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* Allow to push link url to queue by `<S-LeftMouse>` #610.
* Allow to decide if html5 notfication are allowed #651. New setting
'notification=[ask,always,never]' added.
+* Add new env `VIMB_WIN_ID` var for `:shellcmd` which holds the own window id.
### Changed
* Modes some files from `$XDG_CONFIG_HOME/vimb` into `$XDG_DATA_HOME/vimb` #582.
Following files are affected `bookmark`, `closed`, `command`, `config`,
diff --git a/doc/vimb.1 b/doc/vimb.1
index 6f54eb0..2bca209 100644
--- a/doc/vimb.1
+++ b/doc/vimb.1
@@ -969,6 +969,9 @@ Contains the title of the current opened page.
.B VIMB_PID
Contains the pid of the running Vimb instance.
.TP
+.B VIMB_WIN_ID
+Holds the X-Window id of the Vimb window.
+.TP
.B VIMB_XID
Holds the X-Window id of the Vimb window or of the embedding window if Vimb is
compiled with XEMBED and started with the -e option.
diff --git a/src/main.c b/src/main.c
index 07620b3..da81026 100644
--- a/src/main.c
+++ b/src/main.c
@@ -770,9 +770,6 @@ static Client *client_new(WebKitWebView *webview)
static void client_show(WebKitWebView *webview, Client *c)
{
GtkWidget *box;
-#ifndef FEATURE_NO_XEMBED
- char *xid;
-#endif
c->window = create_window(c);
@@ -822,17 +819,22 @@ static void client_show(WebKitWebView *webview, Client *c)
setting_init(c);
gtk_widget_show_all(c->window);
+
+ char *wid;
+ wid = g_strdup_printf("%d", (int)GDK_WINDOW_XID(gtk_widget_get_window(c->window)));
+ g_setenv("VIMB_WIN_ID", wid, TRUE);
#ifndef FEATURE_NO_XEMBED
+ /* set the x window id to env */
if (vb.embed) {
+ char *xid;
xid = g_strdup_printf("%d", (int)vb.embed);
+ g_setenv("VIMB_XID", xid, TRUE);
+ g_free(xid);
} else {
- xid = g_strdup_printf("%d", (int)GDK_WINDOW_XID(gtk_widget_get_window(c->window)));
+ g_setenv("VIMB_XID", wid, TRUE);
}
-
- /* set the x window id to env */
- g_setenv("VIMB_XID", xid, TRUE);
- g_free(xid);
#endif
+ g_free(wid);
/* start client in normal mode */
vb_enter(c, 'n');