awesomeWM / awesome

awesome window manager
https://awesomewm.org/
GNU General Public License v2.0
6.36k stars 597 forks source link

Have a prettier API for dumping the hierarchy #1543

Open Elv13 opened 7 years ago

Elv13 commented 7 years ago

This was asked on IRC

DISPLAY=:1 awesome-client 'return require("gears.debug").dump_return(mouse.screen.mywibox._drawable._widget_hierarchy)'

Does "something", but is an infinite loop as the tree is double chained. Also, the matrix need to be applied "by hand".

psychon commented 7 years ago

...why does someone want to dump the hierarchy? (= Is all the information stored in there needed? Which information would be helpful to add, even though it can be computed from other values? What's the exact problem that should be solved?) Right now I'd say "just look at your wibox to see how the hierarchy looks like".

Does "something", but is an infinite loop as the tree is double chained.

The code applies a maximum depth of 10 for the dump, so it is not an infinite loop. But I'll believe you that it feels like one. Especially since each hierarchy entry points to its parent, its children and the widget context (which in turn points to the whole drawable and thus again into the hierarchy)...

actionless commented 7 years ago

looks so scary:

$ awesome-client 'return require("gears.debug").dump_return(context.topwibox[mouse.screen.index]._drawable._widget_hierarchy)' | wc -l
66721