Extensions: how to query the display orientation?

Currently, when i rotate my laptop back into tablet-mode, the keyboard will automatically get disabled, but not the touchpad. Therefore…

I wrote a little extension that gives me a button on the top-panel so i can quickly enable/disable my touchpad. But I would like to trigger the extension whenever the display orientation in not Landscape.

I am struggling to find how to query the display orientation on a wayland session. I would like to be able to get the 4 orientations (ie, Landscape, Portrait-left, Portait-right, Landscape(flipped)).

Tips appreciated.