Skip to content
Myr

config: add image-size-ratio

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This allows us to override the default size of the “large” icon we display when there are only a “few” matches. This patch also changes the default ratio from 0.618 to 0.500

authored by Daniel Eklöf · committed by Daniel Eklöf · parent bbec76c · Browse files · 6 files+30 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+30 added−2 removed

  • other:+30 added−2 removed

6 files+30 added−2 removed

modified:doc/fuzzel.ini.5.scd+4 added
145 unmodified lines
146*inner-pad*147 Vertical padding between prompt and match list, in148 pixels. Default: _0_.149150*image-size-ratio*151 The ratio of the large image displayed when there are only a "few"152 matches, compared to the full window size. Default: _0.5_.153154*line-height*155 Override line height from font metrics. Default: use font metrics.156157*letter-spacing*
59 unmodified lines
modified:CHANGELOG.md+5 added-1 removed
32 unmodified lines
33* Escape sequences in `Exec` arguments are now supported.34* Multiple space-separated search words can now be entered at the prompt.35* `-M,--selection-match-color`, that lets you configure the color of36 matched substrings of the currently selected item37* New config option `image-size-ratio`, allowing you to control the38 size of the large image displayed when there are only a “few”39 matches.403841[3]: https://codeberg.org/dnkl/fuzzel/issues/342[107]: https://codeberg.org/dnkl/fuzzel/issues/10743[108]: https://codeberg.org/dnkl/fuzzel/issues/10844[120]: https://codeberg.org/dnkl/fuzzel/issues/120
11 unmodified lines
56 ([#106][106]).57* Improved performance of initial rendering of icons ([#124][124]).58* `--terminal` now defaults to `$TERMINAL -e`.59* Font shaping is now applied to the prompt60* The large image displayed when there are only a “few” matches is now61 smaller by default.6263[101]: https://codeberg.org/dnkl/fuzzel/issues/10164[106]: https://codeberg.org/dnkl/fuzzel/issues/10665[124]: https://codeberg.org/dnkl/fuzzel/issues/124
318 unmodified lines
modified:config.c+15 added
473 unmodified lines
474475 else if (strcmp(key, "letter-spacing") == 0)476 return value_to_pt_or_px(ctx, &conf->letter_spacing);477478 else if (strcmp(key, "image-size-ratio") == 0) {479 float ratio;480 if (!value_to_double(ctx, &ratio))481 return false;482483 if (ratio < 0. || ratio > 1.) {484 LOG_CONTEXTUAL_ERR("not in range 0.0 - 1.0");485 return false;486 }487488 conf->image_size_ratio = ratio;489 return true;490 }491492 else493 LOG_CONTEXTUAL_ERR("not a valid option: %s", key);494495 return false;
449 unmodified lines
945 .border = {946 .size = 1u,947 .radius = 10u,948 },949 .image_size_ratio = 0.5,950 .line_height = {-1, 0.0},951 .letter_spacing = {0},952 };953
70 unmodified lines
modified:config.h+2 added
82 unmodified lines
83 unsigned size;84 unsigned radius;85 } border;8687 float image_size_ratio;8889 struct pt_or_px line_height;90 struct pt_or_px letter_spacing;91};92
8 unmodified lines
modified:fuzzel.ini+2 added
15 unmodified lines
16# horizontal-pad=4017# vertical-pad=818# inner-pad=01920# image-size-ratio=0.52122# line-height=<use font metrics>23# letter-spacing=02425[colors]
14 unmodified lines
modified:render.c+2 added-1 removed
618 unmodified lines
619 /* If currently selected item has a scalable icon, and if620 * there's "enough" free space, render a large621 * representation of the icon */622623 const double size = min(buf->height * 0.618, buf->width * 0.618);623 const double ratio = render->conf->image_size_ratio;624 const double size = min(buf->height * ratio, buf->width * ratio);625 const double img_x = (buf->width - size) / 2.;626 const double img_y_bottom = max(buf->height - first_row, 0.);627 const double img_y = max(img_y_bottom - size, 0.);628
188 unmodified lines