awesome icon indicating copy to clipboard operation
awesome copied to clipboard

add default wibox layout + minor change

Open antonilol opened this issue 2 years ago • 2 comments

when no layout is specified no error will popup but instead it will use the default wibox.layout.fixed.horizontal

and a minor change: error happened -> error occurred (2x)

antonilol avatar Dec 03 '21 19:12 antonilol

i thought of both (align and fixed) and found out fixed is used more (in default rc.lua) btw, what is this? (the ())

is there a difference between wibox.layout.fixed.horizontal and wibox.layout.fixed.horizontal()?

antonilol avatar Dec 04 '21 21:12 antonilol

btw, what is this? (the ())

is there a difference between wibox.layout.fixed.horizontal and wibox.layout.fixed.horizontal()?

Let's say : no, there is no difference for the end-user.

The long version is :

wibox.layout.fixed.horizontal is the "class" while wibox.layout.fixed.horizontal() is an instance, since calling the class will actually call the constructor (thanks to our meta-table implementation). The second version (with extra parenthesis), will build/instantiate a horizontal fixed layout object, while the first version (without the parenthesis), basically is a reference to the class.

As you probably have seen in the drill function, we look for certain properties to determine what is the widgets (1) that the user want to use. We either, instantiate a new one if this is a table, or use the instance provided. Then, we assign the desired values to all the properties.

(1) Widgets, layouts and containers are all derivative of the same "object", so let's call them all "widgets" here.

Aire-One avatar Dec 05 '21 13:12 Aire-One