diff options
-rw-r--r-- | man/feh.pre | 13 | ||||
-rw-r--r-- | src/slideshow.c | 12 |
2 files changed, 23 insertions, 2 deletions
diff --git a/man/feh.pre b/man/feh.pre index 3119e48..22caf8c 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -1073,6 +1073,10 @@ Image path/filename Escaped image path/filename .Pq for use in shell commands . +.It %g +. +w,h window dimensions in pixels (mnemonic: geometry) +. .It %h . Image height @@ -1108,8 +1112,9 @@ Number of image pixels . .It \&%P . -Number of image pixels +Number of image pixels in human-readable format with k/M .Pq kilopixels / megapixels +suffix . .It %r . @@ -1148,7 +1153,11 @@ Process ID . .It %z . -current image zoom +Current image zoom, rounded to two decimal places +. +.It %Z +. +Current image zoom, higher precision . .It %% . diff --git a/src/slideshow.c b/src/slideshow.c index effdcaf..7bad2c9 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -468,6 +468,12 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid) if (file) strncat(ret, shell_escape(file->filename), sizeof(ret) - strlen(ret) - 1); break; + case 'g': + if (winwid) { + snprintf(buf, sizeof(buf), "%d,%d", winwid->w, winwid->h); + strncat(ret, buf, sizeof(ret) - strlen(ret) - 1); + } + break; case 'h': if (file && (file->info || !feh_file_info_load(file, NULL))) { snprintf(buf, sizeof(buf), "%d", file->info->height); @@ -564,6 +570,12 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid) strncat(ret, "1.00", sizeof(ret) - strlen(ret) - 1); } break; + case 'Z': + if (winwid) { + snprintf(buf, sizeof(buf), "%f", winwid->zoom); + strncat(ret, buf, sizeof(ret) - strlen(ret) - 1); + } + break; case '%': strncat(ret, "%", sizeof(ret) - strlen(ret) - 1); break; |