Is there a way to programatically work out which display is considered the "primary" display for X within emacs?
I've managed to get a function working that determines if the machine has more than one display connected to it:
(defun how-many-displays () (safe-length (display-monitor-attributes-list)))
I expected that in the list of display attributes, there'd be a way to determine which monitor X thinks is the primary monitor. But unfortunately, the only way to do this seems to be reliant upon defining the monitor layout for each machine I'll be using this config on (which is two machines, but one of them is a laptop that I connect to external displays and as such it will have two configurations).
What I'd like is to be able to determine which display is the primary, and then parse out the geometry so I can calculate offsets for the window position.