Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

haskell

xmonad

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.

like image 211
d8d0d65b3f7cf42 Avatar asked Apr 24 '14 14:04

d8d0d65b3f7cf42


2 Answers

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.

like image 183
duplode Avatar answered Nov 16 '22 15:11

duplode


Here is a copy of my answer from here. I will preface it by giving a terminology clarification: what you call "screen" is called a "workspace" in xmonad parlance, and what you call "monitor" is called a "screen".

By default, this is what happens:

  1. There are 10 distinct workspaces, numbered 1-10.
  2. Each screen is assigned one of the ten workspaces.
  3. There are two ways to navigate: you can choose to focus a particular screen (via mod+w,e,r) or to focus a particular workspace (mod+1,2,...,0).
  4. If you focus a particular screen, the assignment of screens to workspaces does not change, but the selected screen gets input focus.
  5. If you focus a particular workspace, and that workspace is not currently visible on one of the screens, then the currently focused screen has its mapping changed to that workspace.
  6. If you focus a particular workspace, and that workspace is currently visible on one of the screens, then the currently focused screen and the screen showing that workspace have their mappings swapped.

There's two common ways of tweaking this behavior. One way is to change case (6) to keep the mapping as is, but change input focus to the screen that is showing the workspace you selected. See view. The other way is to change (1) and (3) in tandem: create (10 * number of screens) workspaces, and arrange for the mod+1,2,...,0 keybindings to choose which workspace to jump to based on both which key you pressed and which screen is currently focused. The result of this modification is to create the illusion that each screen has an independent set of workspaces that never interfere with each other -- rendering case (6), the confusing case, impossible. See IndependentScreens.

like image 44
Daniel Wagner Avatar answered Nov 16 '22 16:11

Daniel Wagner