summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-06-17 19:18:44 +0200
committerGitHub <noreply@github.com>2020-06-17 19:18:44 +0200
commit5c59089f12b7b07d46626ecdccf0cfcd4e875e26 (patch)
treebf0a3a4a4521d2389c7bdbafc6286e41214a9aee
parent9df1b5b04923340aca69ce3ed4565fceeb042c01 (diff)
parentf0361c5ea6fcdc181863286dbe4de36003eccb9d (diff)
Merge pull request #500 from reiseb/master
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 a27f042..680a3f4 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -1200,6 +1200,10 @@ file
.
.Bl -tag -width indent
.
+.It %a
+.
+Information about slideshow state (playing/paused)
+.
.It %f
.
Image path/filename
diff --git a/src/help.raw b/src/help.raw
index 8d30544..e0fb62a 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 (playing/paused)
%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..a5526a2 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 re-render the image to update the info string immediately. */
+ winwidget_render_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..03e8e06 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, "paused", sizeof(ret) - strlen(ret) - 1);
+ }
+ else {
+ strncat(ret, "playing", sizeof(ret) - strlen(ret) - 1);
+ }
+ break;
case 'f':
if (file)
strncat(ret, file->filename, sizeof(ret) - strlen(ret) - 1);