Skip to content

add option to scale window_logo via window_logo_scale#7534

Merged
kovidgoyal merged 3 commits intokovidgoyal:masterfrom
amuDev:window-logo-scaling
Jun 14, 2024
Merged

add option to scale window_logo via window_logo_scale#7534
kovidgoyal merged 3 commits intokovidgoyal:masterfrom
amuDev:window-logo-scaling

Conversation

@amuDev
Copy link
Copy Markdown

@amuDev amuDev commented Jun 12, 2024

Implements what was discussed in #7532.

New option window_logo_scale takes int 0-100, scales the window logo image to x% of the window dimensions (smallest dimension sets scale).

Problem, using the current window_logo, you are able to position and clamp, but unable to enable scaling such that the logo does not take up too much space on a small terminal or be too small on a large terminal. Alternative solution would be to use background_image with cscale, yet if you want to have a logo anywhere other than the centre of the terminal, this quickly falls apart once you begin resizing the terminal outside the aspect ratio of the original image.
image

Adding the option to scale the window logo allows for the original goal of #7532 while being quite generic and overall a very minor code addition.
Here is an example of the proposed implementation to demonstrate the new option.
image

@kovidgoyal
Copy link
Copy Markdown
Owner

Looks OK but perhaps make it

window_logo width% [height%]

so that each can be specified independently. Having one number means %
of the smallest dimension.

A value of zero means no scaling in that dimension. A single zero (the
default) means no scaling at all.

And make it a float rather than an int so we can get higher precision.
Dont really gain anything by having it be an integer.

@amuDev
Copy link
Copy Markdown
Author

amuDev commented Jun 13, 2024

Implemented comments, not the cleanest way to implement the cases but should be quite clear the intent of each case at a glance. Was especially unsure on implementing the optional parameter for the height, decided -1 as a default would be sufficient for initial implementation but if there is a more clear way to handle this with the framework that I didn't catch point me to it!

@kovidgoyal kovidgoyal merged commit 192bd8a into kovidgoyal:master Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants