How to get the height of a window in the `Overview` in Gnome 41?

Hi,

Background: I want to move this._icon and this._title to the center or any position in the windowContainer.

How to get the height of a window in the Overview in Gnome 41?

(Note that I mean the small window with an app icon and a title on it in the Overview. I’m now sure what should I call it :sweat_smile:)

Can I get this value within windowPreview.WindowPreview instance? How?

I can get a height via const [width, height] = this.window_container.get_size() but this height is not what I expect.

Any advice?

Thank you very much. :blush:

Background: I want to move this._icon and this._title to the center or any position in the windowContainer.

I did a search and found a solution to make this._icon on the center:

const icon_constraints = this._icon.get_constraints();
for (const constraint of icon_constraints) {
	if (constraint instanceof Clutter.AlignConstraint) {
		const align_axis = constraint.align_axis;
		// 1 is Clutter.AlignAxis.Y_AXIS
		if (align_axis === 1) {
			constraint.set_factor(0.5);
		}
	}
}

But I still want to know how to get the height of a thumbnail of a window…

factor: 0(top), 0.5(middle), 1(bottom)

See: Clutter.AlignConstraint.set_factor – clutter-1.0

Perhaps you want Clutter.Actor.get_preferred_size() or Clutter.Actor.get_transformed_size()? It would be easier to help if you explained what result you’re getting and what result you’re expecting.

1 Like

I’ll test the two functions later. Thank you.