aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexamples/key-handler12
-rw-r--r--main.c1
-rw-r--r--nsxiv.114
3 files changed, 19 insertions, 8 deletions
diff --git a/examples/key-handler b/examples/key-handler
index 6ac754b..7dac1b5 100755
--- a/examples/key-handler
+++ b/examples/key-handler
@@ -3,10 +3,14 @@
# Example for $XDG_CONFIG_HOME/nsxiv/exec/key-handler
# Called by nsxiv(1) after the external prefix key (C-x by default) is pressed.
# The next key combo is passed as its first argument. Passed via stdin are the
-# images to act upon, one path per line: all marked images, if in thumbnail
-# mode and at least one image has been marked, otherwise the current image.
-# nsxiv(1) blocks until this script terminates. It then checks which images
-# have been modified and reloads them.
+# images to act upon: all marked images, if in thumbnail mode and at least one
+# image has been marked, otherwise the current image. nsxiv(1) will block until
+# the handler terminates. It then checks which images have been modified and
+# reloads them.
+
+# By default nsxiv(1) will send one image per-line to stdin, however when using
+# -0 the image list will be NULL separated and the enviornment variable
+# "$NSXIV_USING_NULL" will be set to 1.
# The key combo argument has the following form: "[C-][M-][S-]KEY",
# where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X
diff --git a/main.c b/main.c
index 5bab026..69a1f63 100644
--- a/main.c
+++ b/main.c
@@ -549,6 +549,7 @@ void run_key_handler(const char *key, unsigned int mask)
mask & ControlMask ? "C-" : "",
mask & Mod1Mask ? "M-" : "",
mask & ShiftMask ? "S-" : "", key);
+ setenv("NSXIV_USING_NULL", options->using_null ? "1" : "0", 1);
if ((pid = fork()) == 0) {
close(pfd[1]);
diff --git a/nsxiv.1 b/nsxiv.1
index f968f3b..f63994c 100644
--- a/nsxiv.1
+++ b/nsxiv.1
@@ -439,14 +439,20 @@ located in
The handler is invoked by pressing
.BR Ctrl-x .
The next key combo is passed as its first argument. Passed via stdin are the
-images to act upon, one path per line: all marked images, if in thumbnail mode
-and at least one image has been marked, otherwise the current image.
-nsxiv(1) will block until the handler terminates. It then checks which images
-have been modified and reloads them.
+images to act upon: all marked images, if in thumbnail mode and at least one
+image has been marked, otherwise the current image. nsxiv(1) will block until
+the handler terminates. It then checks which images have been modified and
+reloads them.
+
+By default nsxiv(1) will send one image per-line to stdin, however when using
+\-0 the image list will be NULL separated and the enviornment variable
+"$NSXIV_USING_NULL" will be set to 1.
The key combo argument has the following form: "[C-][M-][S-]KEY",
where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X
keysym as listed in /usr/include/X11/keysymdef.h without the "XK_" prefix.
+If KEY has an uppercase equivalent, S-KEY is resolved into it. For instance,
+K replaces S-k and Scedilla replaces S-scedilla, but S-Delete is sent as-is.
There is also an example script installed together with nsxiv as
.IR EGPREFIX/key-handler .