summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-09-18 19:16:08 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-09-18 19:16:08 +0200
commitb1e8bdaf5bf1c3c9c2d3ae2ba93796b6d0dddddf (patch)
treef0e465854924162ecf844a8e64085d5c3ffcfc9e
parent775135336008ef48308d496b1ef1c06fdd58ed9e (diff)
add %W format specifier (#719)
-rw-r--r--man/feh.pre5
-rw-r--r--src/slideshow.c6
2 files changed, 11 insertions, 0 deletions
diff --git a/man/feh.pre b/man/feh.pre
index e8fe87d..28dc5f4 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -1353,6 +1353,11 @@ Number of current file
.
Image width
.
+.It %W
+.
+Window dimensions and offset as WxH+x+y
+.Pq X11 geometry format .
+.
.It %v
.
.Nm
diff --git a/src/slideshow.c b/src/slideshow.c
index 41e9ecc..a53749e 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -529,6 +529,12 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid)
strncat(ret, buf, sizeof(ret) - strlen(ret) - 1);
}
break;
+ case 'W':
+ if (winwid) {
+ snprintf(buf, sizeof(buf), "%dx%d+%d+%d", winwid->w, winwid->h, winwid->x, winwid->y);
+ strncat(ret, buf, sizeof(ret) - strlen(ret) - 1);
+ }
+ break;
case 'z':
if (winwid) {
snprintf(buf, sizeof(buf), "%.2f", winwid->zoom);