aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/imv.1.txt3
-rw-r--r--src/imv.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/doc/imv.1.txt b/doc/imv.1.txt
index 6474036..98b4498 100644
--- a/doc/imv.1.txt
+++ b/doc/imv.1.txt
@@ -161,6 +161,9 @@ When imv executes a shell command, it provides a number of environment variables
exposing imv's state. These environment variables are also available when
customising the window's title, or the overlay text.
+*$imv_pid*::
+ The pid of this instance of imv. Useful for running imv-msg in scripts.
+
*$imv_current_file*::
Path of currently selected image.
diff --git a/src/imv.c b/src/imv.c
index 2d948fa..0f42371 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -1675,6 +1675,9 @@ static void update_env_vars(struct imv *imv)
{
char str[64];
+ snprintf(str, sizeof str, "%d", getpid());
+ setenv("imv_pid", str, 1);
+
setenv("imv_current_file", imv_navigator_selection(imv->navigator), 1);
setenv("imv_scaling_mode", scaling_label[imv->scaling_mode], 1);
setenv("imv_loading", imv->loading ? "1" : "0", 1);