From 918edfaa6254fcd7d328ced434f361b19a636576 Mon Sep 17 00:00:00 2001 From: reiseb <48870100+reiseb@users.noreply.github.com> Date: Sun, 12 Jan 2020 15:48:57 +0100 Subject: add option 'a' to show play/paused information in slideshow mode --- man/feh.pre | 4 ++++ src/help.raw | 1 + src/keyevents.c | 2 ++ src/slideshow.c | 8 ++++++++ 4 files changed, 15 insertions(+) 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); -- cgit v1.2.3