how does xmonad assign numbers to screens, and screens to (two) monitors

haskell, xmonad

Solution

The `XMonad.Actions.PhysicalScreens` documentation says the following:

This module allows you name Xinerama screens from XMonad using their physical location relative to each other (as reported by Xinerama), rather than their ScreenID s, which are arbitrarily determined by your X server and graphics hardware.

Screens are ordered by the upper-left-most corner, from top-to-bottom and then left-to-right.

I believe that "physical location relative to each other" refers to the layout specified by the `ServerLayout` section of Xinerama's configuration file. I am doing a bit of guesswork here, as I am not very familiar with Xinerama, but it seems that module can help with the issue of unpredictable screen numbers.

Problem

I am using xmonad (with minimal configuration, `main = xmonad gnomeConfig{ modMask = mod4Mask, terminal = "gnome-terminal" }`) and my computer has two monitors and I am using xinerama. This works, but way too often I am surprised by the mapping of xmonad screens to monitors, when pushing a window to a screen (shift-mod-N) or moving focus to a screen (mod-N). Also, mate-panel shows window symbols on virtual screens symbols - but something is not right there (these virtual screen seem to have double width, I guess because it's one X screen) What is the right mental model for this? (Is there a magic key that shows the screen number of the current (focused) window?) NOTE (suggested by answers below): in xmonad lingo, a window is on a workspace, and a workspace is mapped to a (physical) screen.

Original source