diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-09-29 17:10:19 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-09-29 17:10:19 +0200 |
commit | 702db61e222518bf71383e471547c233322b6b7f (patch) | |
tree | b001b87fee715ec1bd2400ec3579c41b90325cc3 | |
parent | 7281c129a9bf11594179a768aa34213fe69e98ed (diff) | |
download | feh-702db61e222518bf71383e471547c233322b6b7f.zip |
feh_printf: Add %S (size in kB)
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/slideshow.c | 7 |
2 files changed, 8 insertions, 0 deletions
@@ -4,6 +4,7 @@ git HEAD * Fix --info bug when the command wrote no lines to stdout * The button-options -0 through -9 are no longer supported. Use .config/feh/buttons instead (see feh manpage) + * New format specifier: %S (size in kB) Mon, 26 Sep 2011 09:35:41 +0200 Daniel Friesel <derf@finalrewind.org> diff --git a/src/slideshow.c b/src/slideshow.c index 52ef4b3..b9d9494 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -419,6 +419,13 @@ char *feh_printf(char *str, feh_file * file) strcat(ret, buf); } break; + case 'S': + if (file && (file->info || !feh_file_info_load(file, NULL))) { + snprintf(buf, sizeof(buf), + "%.2fkB", ((double)file->info->size / 1000)); + strcat(ret, buf); + } + break; case 'p': if (file && (file->info || !feh_file_info_load(file, NULL))) { snprintf(buf, sizeof(buf), "%d", file->info->pixels); |