X11/Wayland
RandR
RandR (resize and rotate) is a communications protocol written as an extension to the X11 protocol. XRandR provides the ability to resize, rotate and reflect the root window of a screen. RandR is responsible for setting the screen refresh rate. It allows for the control of multiple monitors.
XRandR
xrandr is a command-line tool to interact with the X RandR extension [see x.org, wikipedia], which allows for live (re)configuration of the X server (i.e. without restarting it): It provides automatic discovery of modes (resolutions, refresh rates, etc.) together with the ability to configure outputs dynamically (resize, rotate, move, etc.).
Image of 'xrandr' output on Ubuntu (WSL2)

Image of 'xrandr --help' output on Ubuntu (WSL2)

TODO: how does one query all refresh rates for a given resolution of a display?
Alternatively...
See https://github.com/wertarbyte/autorandr/blob/master/pm-utils/40autorandr
detect_display()
{
for X in /tmp/.X11-unix/X*; do
D="${X##/tmp/.X11-unix/X}"
user=$(who | awk -vD="$D" '$5 ~ "\\(:"D"\\)$" {print $1}')
if [ x"$user" != x"" ]; then
export DISPLAY=":$D"
/bin/su -c "${AUTORANDR}" "$user"
fi
done
}
or, in one line
(cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done)
This the available "Screens" i.e. the top-level "window" that host all other windows. The virtual desktop.
--
Alternatively, the variable DISPLAY
Mac OS X
I'll research these window systemx a bit more at a later date. It's quite late (or early?) at night right now.
X11/Wayland
RandR
XRandR
Image of 'xrandr' output on Ubuntu (WSL2)
Image of 'xrandr --help' output on Ubuntu (WSL2)
TODO: how does one query all refresh rates for a given resolution of a display?
Alternatively...
See https://github.com/wertarbyte/autorandr/blob/master/pm-utils/40autorandr
or, in one line
This the available "Screens" i.e. the top-level "window" that host all other windows. The virtual desktop.
--
Alternatively, the variable
DISPLAYMac OS X
I'll research these window systemx a bit more at a later date. It's quite late (or early?) at night right now.