Detect size of guest screen in the virtualbox guest

I am running a (Fedora) linux in a virtualbox 6.1 (also 6.0) guest. How can I programatically detect the screen size of this guest, so when i resize my guest window (outside) to any screen size (full screen, half screen, quarter screen), how can I detect this change in the (fedora) guest and run a script, with the current “screen size” ?