See also bug#34516, which has a patch from me to invent monitor names on macOS. That bug also points at code from <https://github.com/glfw/glfw>, which someone motivated could perhaps copy.