kolunmi / dwlb

Feature-Complete Bar for DWL
Other
64 stars 21 forks source link

Integer scaling using buffer_scale #7

Closed arnor-nolen closed 1 year ago

arnor-nolen commented 1 year ago

Hey, I like your bar quite a lot, so I decided to contribute.

I am personally using 1.25 and 1.5 scale values on my monitors and I have noticed that your bar doesn't support scaling, so the bar looks very blurry/pixelated. If you know how scaling is organized in Wayland, there's two ways of dealing with scaling: so-called "integer scaling" and "fractional scaling". Fractional scaling is quite new, so I decided to implement integer scaling through an ability to supply buffer_scale value to the compositor. This allows you to render surfaces at (for example) 2x scale and the compositor will do the rest of the job by scaling it down to 1.25x or 1.5x. This is not ideal, but this is how scaling on Wayland was done before fractional scaling was introduced.

I might also create a PR that uses fractional scaling, but integer scaling is a good starting point.

Not sure if this is supposed to be a patch or PR, feel free to propose your solution.

Changelog:

kolunmi commented 1 year ago

Hello! Thanks so much for the pr! Could you add a -scale option to the help text and accept it as a command line option so I can merge this?

arnor-nolen commented 1 year ago

Added -scale as an option you can pass, also added explanations to both help message and README file. If you don't like my explanations, you can change it as you like.

Here's an example of using 1.5 scaling monitor. Before patching (or running with dwlb -scale 1): image After patching (with dwlb -scale 2): image

As you can see, bar height did not change, but everything is rendered at higher detail.

kolunmi commented 1 year ago

Looks good, thank you!