mortie / swaylock-effects

Swaylock, with fancy effects
MIT License
707 stars 46 forks source link

--effect-compose size not affected by scaling, proposing additional modifier #31

Closed Zocker1999NET closed 3 years ago

Zocker1999NET commented 3 years ago

Quoted the manual of --effect-compose:

  • <size>: Optional. The size of the image on the screen, as <w>x<h>.
    • Can be a percentage (10%x10%), a number of pixels (20x20), or a mix (30%x40).
    • If the width is -1, the width is figured out based on the height and aspect ratio.
    • If the height is -1, the height is figured out based on the width and aspect ratio.
    • Default: The size of the image file.

I want to use effect-compose to add a company logo above the indicator in a similar size. As I tried to resize it to the right size I discovered that the indicator's size is affected by scaling of the output but the size of effect-compose is not. For explaining, I have two screens (the internal of my laptop and an external screen) and the laptop screen has enabled an scaling of 2 while the normal screen has a scaling of 1. Also both screens have different resolutions (3000x2000 vs 2560x1440). Because of the different resolutions, I cannot use the % modifier and because of the different scaling, I cannot use an absolute declaration.

I would propose adding a new modifier (maybe a ~ or something else) which allows setting the size in pixels but is affected by the scaling of the screen (e.g. 300~x-1), if this is possible to implement. Also a ~% modifier must not be implemented because it makes no sense that a fraction of the screen size may be affected by the scaling. This would allow users using different scalings on different screens to let symbols having the same size relative to the indicator across different screens for example, while keeping the old behavior that the pixel size is not affected by the scaling.

mortie commented 3 years ago

You're right, scaling should be respected by default. I'm not even sure if adding a syntax for specifying the size in physical screen pixels is even worth it, I would guess the use case for that would be very limited.

mortie commented 3 years ago

Alright, as of commit https://github.com/mortie/swaylock-effects/commit/84389734474572f1e99c88c42424d19b0b80742b, the non-percent numbers in --effect-compose should respect scaling.