Skip to content
Snippets Groups Projects
Commit 1e212f65 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Add %g and %Z format specifiers (closes #391)

parent f8640490
No related branches found
No related tags found
No related merge requests found
...@@ -1014,6 +1014,10 @@ Image path/filename ...@@ -1014,6 +1014,10 @@ Image path/filename
Escaped image path/filename Escaped image path/filename
.Pq for use in shell commands .Pq for use in shell commands
. .
.It %g
.
w,h window dimensions in pixels (mnemonic: geometry)
.
.It %h .It %h
. .
Image height Image height
...@@ -1048,8 +1052,9 @@ Number of image pixels ...@@ -1048,8 +1052,9 @@ Number of image pixels
. .
.It \&%P .It \&%P
. .
Number of image pixels Number of image pixels in human-readable format with k/M
.Pq kilopixels / megapixels .Pq kilopixels / megapixels
suffix
. .
.It %r .It %r
. .
...@@ -1087,7 +1092,11 @@ Process ID ...@@ -1087,7 +1092,11 @@ Process ID
. .
.It %z .It %z
. .
current image zoom Current image zoom, rounded to two decimal places
.
.It %Z
.
Current image zoom, higher precision
. .
.It %% .It %%
. .
......
...@@ -468,6 +468,12 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid) ...@@ -468,6 +468,12 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid)
if (file) if (file)
strncat(ret, shell_escape(file->filename), sizeof(ret) - strlen(ret) - 1); strncat(ret, shell_escape(file->filename), sizeof(ret) - strlen(ret) - 1);
break; 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': case 'h':
if (file && (file->info || !feh_file_info_load(file, NULL))) { if (file && (file->info || !feh_file_info_load(file, NULL))) {
snprintf(buf, sizeof(buf), "%d", file->info->height); snprintf(buf, sizeof(buf), "%d", file->info->height);
...@@ -564,6 +570,12 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid) ...@@ -564,6 +570,12 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid)
strncat(ret, "1.00", sizeof(ret) - strlen(ret) - 1); strncat(ret, "1.00", sizeof(ret) - strlen(ret) - 1);
} }
break; break;
case 'Z':
if (winwid) {
snprintf(buf, sizeof(buf), "%f", winwid->zoom);
strncat(ret, buf, sizeof(ret) - strlen(ret) - 1);
}
break;
case '%': case '%':
strncat(ret, "%", sizeof(ret) - strlen(ret) - 1); strncat(ret, "%", sizeof(ret) - strlen(ret) - 1);
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment