files/en-us/web/api/windowcontrolsoverlay/geometrychange_event/index.md
{{APIRef("Window Controls Overlay API")}}{{SeeCompatTable}}
The geometrychange event is fired when the position, size, or visibility of a Progressive Web App's title bar area changes.
This only applies to Progressive Web Apps installed on desktop operating systems and use the Window Controls Overlay API.
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
addEventListener("geometrychange", (event) => { })
ongeometrychange = (event) => { }
A {{domxref("WindowControlsOverlayGeometryChangeEvent")}}. Inherits from {{domxref("Event")}}.
{{InheritanceDiagram("WindowControlsOverlayGeometryChangeEvent")}}
In addition to the properties listed below, properties from the parent interface, {{domxref("Event")}}, are available.
titlebarAreaRect
visible
Using addEventListener():
navigator.windowControlsOverlay.addEventListener("geometrychange", (event) => {
const { x, y, width, height } = event.titlebarAreaRect;
console.log(
`The titlebar area coordinates are x:${x}, y:${y}, width:${width}, height:${height}`,
);
});
Using the ongeometrychange event handler property:
navigator.windowControlsOverlay.ongeometrychange = (event) => {
const { x, y, width, height } = event.titlebarAreaRect;
console.log(
`The titlebar area coordinates are x:${x}, y:${y}, width:${width}, height:${height}`,
);
};
{{Specifications}}
{{Compat}}