Aylur / ags

A customizable and extensible shell
GNU General Public License v3.0
1.74k stars 94 forks source link

Getting width/height elements #460

Closed myryk31415 closed 2 weeks ago

myryk31415 commented 2 weeks ago

I wanna use the width of the elements to hide them if the screen is not wide enough to show them all. Is there any way to get the width/height of elements?

I could get the min-width from the css manually but that seems a bit tedious and also doesn't reflect the actual width accuratly.

kotontrion commented 2 weeks ago
const allocation = widget.get_allocation();
const width = allocation.width;
const height = allocation.height;
const x = allocation.x;
const y = allocation.y;

const width = widget.get_allocated_width()
const height = widget.get_allocated_height()

might be useful as well: a widget will emit a size-allocatesignal when its size changed.

myryk31415 commented 2 weeks ago

Thanks a lot :)

Where do I find documentation of stuff like that? Not the ags-wiki right? GTK docs?

myryk31415 commented 2 weeks ago

https://docs.gtk.org/gtk3