awesome icon indicating copy to clipboard operation
awesome copied to clipboard

Adding the option to choose a border side, similar to margins

Open Crylia opened this issue 2 years ago • 7 comments

Currently if you want a border you do border_width which draws a full border. But it would actually be nice to be able to choose a single side similar to CSS or how the wibox.container.margin works.

While one is an entire container and the other a common property it would still be a good addition imo

Crylia avatar Aug 15 '22 23:08 Crylia

the other [is] a common property

It is not a "common" property. Whenever it is implemented, it is done so in isolation and little to nothing is shared with any other instance. If your desired behaviour should be unified, it would need to be implemented and maintained separately in half a dozen places.

But for widgets, that would be redundant, as you can already use the very same margin container to create a selective, colored border around the child widget.

sclu1034 avatar Aug 16 '22 07:08 sclu1034

But for widgets, that would be redundant, as you can already use the very same margin container to create a selective, colored border around the child widget.

But this approach comes with a few downsides. You can't have a shape, the border will always be straight or at the very least have an edge on the inside since you could put a border around it, but not inside. Then there is the downside to always having a margin since it doubles as a border_width now, usually there is a property to choose weather not you want to affect the content or not(While its possible to workaround, its quiet some work as to a simple property).

Crylia avatar Aug 16 '22 10:08 Crylia

Then that would warrant a new type of container widget that can handle that stuff. But all of that complexity should not be put into widgets whose job isn't drawing borders.

sclu1034 avatar Aug 16 '22 13:08 sclu1034

Maybe add that to wibox.container.background instead of creating a new container.

Crylia avatar Aug 16 '22 19:08 Crylia

Good news everyone: https://github.com/awesomeWM/awesome/pull/3559

But in practice there is a reason why it would be hard to add to the background container. It's actually the same reason why I made the border one. The background container, despite it's name, evolved into a "shape" container over time (yes, I did that). Shapes are just dumb paths and implementing different size would be nearly impossible. The new one, on the other hand, allows widgets or images (including inline SVG/CSS) to be used as borders. The current implementation might not do 100% what you want. Try it, break it, comment there. Beside, I agree with @sclu1034, I would rather have many annoying composition layers than implement everything in a dozen different widgets. border_* and margins/padding are in many because they have corner cases which could not be handled in any other way. That doesn't mean we should duplicate properties for the sake of it.

Elv13 avatar Aug 18 '22 04:08 Elv13

can we achieve setting bottom border/margin to be greater than others side in each tag? only the bottom

naranyala avatar Aug 19 '23 14:08 naranyala

can we achieve setting bottom border/margin to be greater than others side in each tag? only the bottom

Do you mean something like this?

{
  widget = wibox.container.margin,
  left = 20,
  right = 10,
  top = 40,
  bottom = 30
}

That would only work for magins but not borders, but there is a PR #3559 that adds the ability to have different borders for each side iirc

Crylia avatar Aug 20 '23 02:08 Crylia