francma / wob

A lightweight overlay volume/backlight/progress/anything bar for Wayland.
ISC License
911 stars 50 forks source link

Adjust margin to allow for x-axis and y-axis values #111

Closed stvsu closed 1 year ago

stvsu commented 1 year ago

Updated configuration options to allow for margin_x and margin_y.

Tested locally and works great!

francma commented 1 year ago

Hello. I would prefer this variant:

margin = top right bottom left
margin = top-bottom right-left
margin = all

as described in https://github.com/francma/wob/issues/110#issuecomment-1335885368

stvsu commented 1 year ago

How would your implementation work if the user wants to set a custom offset based on pixels?

My use case is placing the overlay right below the volume/brightness meter on Waybar.

In order to do that, I need to anchor on the top right, and then move away from that location on an (x,y) grid to move it down and left.

francma commented 1 year ago

Currently wob config accepts only one margin value and the result of that is:

zwlr_layer_surface_v1_set_margin(..., margin, margin, margin, margin);

And it would be nice to have it like this:

zwlr_layer_surface_v1_set_margin(..., margin_top, margin_right, margin_bottom, margin_left);

and in order to implement it, we need all 4 values, not just x-axis and y-axis.

I would prefer to have these 4 values under one config key like this:

margin = top right bottom left

With shorthand if user wants to set margin like before:

margin = value

which is just a shorthand for:

margin = value value value value

Optionally we can also support:

margin = value_a value_b

which is a shorthand for:

margin = value_a value_b value_a value_b

It's just like CSS margin is defined.