set env var NSXIV_USING_NULL for key-handler and update docs

Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
master
NRK 2021-11-19 16:08:39 +06:00 committed by N-R-K
parent 2df33208d7
commit 43fcd2e02e
3 changed files with 19 additions and 8 deletions

View File

@ -3,10 +3,14 @@
# Example for $XDG_CONFIG_HOME/nsxiv/exec/key-handler # Example for $XDG_CONFIG_HOME/nsxiv/exec/key-handler
# Called by nsxiv(1) after the external prefix key (C-x by default) is pressed. # 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 # 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 # images to act upon: all marked images, if in thumbnail mode and at least one
# mode and at least one image has been marked, otherwise the current image. # image has been marked, otherwise the current image. nsxiv(1) will block until
# nsxiv(1) blocks until this script terminates. It then checks which images # the handler terminates. It then checks which images have been modified and
# have been modified and reloads them. # 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", # 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 # where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X

1
main.c
View File

@ -549,6 +549,7 @@ void run_key_handler(const char *key, unsigned int mask)
mask & ControlMask ? "C-" : "", mask & ControlMask ? "C-" : "",
mask & Mod1Mask ? "M-" : "", mask & Mod1Mask ? "M-" : "",
mask & ShiftMask ? "S-" : "", key); mask & ShiftMask ? "S-" : "", key);
setenv("NSXIV_USING_NULL", options->using_null ? "1" : "0", 1);
if ((pid = fork()) == 0) { if ((pid = fork()) == 0) {
close(pfd[1]); close(pfd[1]);

14
nsxiv.1
View File

@ -439,14 +439,20 @@ located in
The handler is invoked by pressing The handler is invoked by pressing
.BR Ctrl-x . .BR Ctrl-x .
The next key combo is passed as its first argument. Passed via stdin are the 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 images to act upon: all marked images, if in thumbnail mode and at least one
and at least one image has been marked, otherwise the current image. image has been marked, otherwise the current image. nsxiv(1) will block until
nsxiv(1) will block until the handler terminates. It then checks which images the handler terminates. It then checks which images have been modified and
have been modified and reloads them. 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", 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 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. 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 There is also an example script installed together with nsxiv as
.IR EGPREFIX/key-handler . .IR EGPREFIX/key-handler .