diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-08-15 21:53:54 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-08-15 21:53:54 +0100 |
commit | ec14d5f41251fadc03370c9cbe5f2e0bdb5ca9ff (patch) | |
tree | ae4dbb4d162de5595074fea66274fd87f8f33406 | |
parent | 0efaf810797feb5dbdc3038c2f19f1b17aedd3b2 (diff) | |
download | imv-ec14d5f41251fadc03370c9cbe5f2e0bdb5ca9ff.tar.gz |
imv: Add imv_pid environment variable
-rw-r--r-- | doc/imv.1.txt | 3 | ||||
-rw-r--r-- | src/imv.c | 3 |
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. @@ -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); |