summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreiseb <48870100+reiseb@users.noreply.github.com>2020-01-12 15:48:57 +0100
committerreiseb <48870100+reiseb@users.noreply.github.com>2020-06-16 19:41:43 +0200
commit918edfaa6254fcd7d328ced434f361b19a636576 (patch)
treef445c5a234420eb704c55bbad0ae797ead464786
parenta624883d92ea54886b739f1000e39ccf1afc5577 (diff)
add option 'a' to show play/paused information in slideshow mode
-rw-r--r--man/feh.pre4
-rw-r--r--src/help.raw1
-rw-r--r--src/keyevents.c2
-rw-r--r--src/slideshow.c8
4 files changed, 15 insertions, 0 deletions
diff --git a/man/feh.pre b/man/feh.pre
index c6dae5f..b70d948 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -1204,6 +1204,10 @@ file
.
.Bl -tag -width indent
.
+.It %a
+.
+Information about slideshow state (play/pause)
+.
.It %f
.
Image path/filename
diff --git a/src/help.raw b/src/help.raw
index 8d30544..0a87b70 100644
--- a/src/help.raw
+++ b/src/help.raw
@@ -124,6 +124,7 @@ INDEX MODE OPTIONS
font is specified, a title will not be printed
FORMAT SPECIFIERS
+ %a information about slideshow state (play/pause)
%f image path/filename
%F image path/filename (shell-escaped)
%g window dimensions (\"width,height\") in pixels
diff --git a/src/keyevents.c b/src/keyevents.c
index 0da07d3..761ec3c 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -710,6 +710,8 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy
}
else if (feh_is_kp(EVENT_toggle_pause, state, keysym, button)) {
slideshow_pause_toggle(winwid);
+ /* We need to reload the image to update the info string immediately. */
+ feh_reload_image(winwid, 0, 0);
}
else if (feh_is_kp(EVENT_save_image, state, keysym, button)) {
slideshow_save_image(winwid);
diff --git a/src/slideshow.c b/src/slideshow.c
index 00425d1..2cc8c4f 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -397,6 +397,14 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid)
if ((*c == '%') && (*(c+1) != '\0')) {
c++;
switch (*c) {
+ case 'a':
+ if (opt.paused == 1) {
+ strncat(ret, "pause", sizeof(ret) - strlen(ret) - 1);
+ }
+ else {
+ strncat(ret, "play", sizeof(ret) - strlen(ret) - 1);
+ }
+ break;
case 'f':
if (file)
strncat(ret, file->filename, sizeof(ret) - strlen(ret) - 1);