awesome icon indicating copy to clipboard operation
awesome copied to clipboard

Add a new border container

Open Elv13 opened this issue 3 years ago • 1 comments

This container have 2 main aspect. First, it implement CSS-style slices. So background images stretch properly:

image

note: Ignore the visible artifacts in the image. It's only in the doc because it places raster images in SVG and rescale them incorrectly when the browser scales the SVG.

The second feature is the ability to have side and corner widgets for the border.

Initially, I didn't plan to finish this for this release, but some people shown interest in the chat. There was also some questions in https://github.com/awesomeWM/awesome/pull/3489 about how complex titlebars can be handled without 400 lines of ugly hacks. With this container, you can directly take a background image and end up with this:

image

This is the first part of a 2 part series to fix https://github.com/awesomeWM/awesome/issues/650#issuecomment-312502332 . I will not do the second part before v4.4. The other half is mostly the productionalized version of @psychon code. The new awful.decoration module will not really add size/corner resize by default. However, it will now be trivial to add rather than stupidly hard with 2 wibox.layout.align and 2 wibox.layout.flex like it is right now.

I thought "it's almost fully implemented, how bad can it be to finish it!": very bad... This container was a corner case rabbit hole. I kind of gave up in December, but finally had the guts to finish it. The DPI property is still not exposed. It will take more rabbit hunting down in the rabbit hole.

About the implementation. I hesitated between putting this in wibox.layout or wibox.container. In the end I picked container because it only have 1 "indexed" widget. This deprecated wibox.container.background.bgimage. That's "weird" because it's deprecating the background support for the background container. However, the shape and bgimage were always pretty much incompatible. Extending the background container with all the new properties would have made the code unmaintainable. I added a couple new properties to the background container to compensate for some of the deprecated corner case which could not be handled by the border container.

edit: I also fix a few CSS support bugs. I added CSS support in the wallpaper PR serie, but it wasn't that well tested

Elv13 avatar Feb 05 '22 23:02 Elv13

havent went through the code yet, but description looks nice 👍

actionless avatar Feb 09 '22 18:02 actionless

Codecov Report

Attention: 38 lines in your changes are missing coverage. Please review.

Comparison is base (cb72c0a) 91.01% compared to head (2eab55e) 91.22%. Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3559      +/-   ##
==========================================
+ Coverage   91.01%   91.22%   +0.21%     
==========================================
  Files         901      927      +26     
  Lines       57566    59450    +1884     
==========================================
+ Hits        52392    54233    +1841     
- Misses       5174     5217      +43     
Flag Coverage Δ
gcov 91.22% <97.84%> (+0.21%) :arrow_up:
luacov 93.87% <97.84%> (+0.15%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
lib/wibox/container/init.lua 100.00% <100.00%> (ø)
...amples/wibox/container/background/border_color.lua 100.00% <100.00%> (ø)
...les/wibox/container/background/border_strategy.lua 100.00% <100.00%> (ø)
...amples/wibox/container/background/border_width.lua 100.00% <100.00%> (ø)
...ibox/container/background/stretch_horizontally.lua 100.00% <100.00%> (ø)
.../wibox/container/background/stretch_vertically.lua 100.00% <100.00%> (ø)
...examples/wibox/container/border/border_images1.lua 100.00% <100.00%> (ø)
...xamples/wibox/container/border/border_merging1.lua 100.00% <100.00%> (ø)
...xamples/wibox/container/border/border_widgets1.lua 100.00% <100.00%> (ø)
tests/examples/wibox/container/border/borders1.lua 100.00% <100.00%> (ø)
... and 21 more

... and 6 files with indirect coverage changes

codecov[bot] avatar Dec 31 '23 23:12 codecov[bot]

Merging since this was approved and I only rebased/fixed_new_doc_warnings

Elv13 avatar Dec 31 '23 23:12 Elv13