Skip to content

X11, Wayland, Mac OS X compatibility #2

@BinToss

Description

@BinToss
  • X11/Wayland (used by most Linux distros; Wayland is the successor to the X11 protocol)
  • Mac OS X

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

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

image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions