Skip to content

Instantly share code, notes, and snippets.

@SKoschnicke
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SKoschnicke/d6407a34863da2792738 to your computer and use it in GitHub Desktop.
Save SKoschnicke/d6407a34863da2792738 to your computer and use it in GitHub Desktop.
XMonad two instead four monitors
ghc -e "Graphics.X11.openDisplay [] >>= Graphics.X11.Xinerama.getScreenInfo"

results in

[Rectangle {rect_x = 4080, rect_y = 584, rect_width = 1920, rect_height = 2160}, -- D, DP-4.9
 Rectangle {rect_x = 2160, rect_y = 584, rect_width = 1920, rect_height = 2160}, -- C, DP-4.8
 Rectangle {rect_x = 0, rect_y = 1920, rect_width = 2160, rect_height = 1920}, -- B, DP-2.8
 Rectangle {rect_x = 0, rect_y = 0, rect_width = 2160, rect_height = 1920}]    -- A, DP-2.9

Layout as reported by xrandr:

  A
     C  D
  B

C: DP-4.8 connected primary 1920x2160+4080+584 (normal left inverted right x axis y axis) 527mm x 296mm
D: DP-4.9 connected 1920x2160+2160+584 (normal left inverted right x axis y axis) 527mm x 296mm
B: DP-2.8 connected 2160x1920+0+1920 left (normal left inverted right x axis y axis) 527mm x 296mm
A: DP-2.9 connected 2160x1920+0+0 left (normal left inverted right x axis y axis) 527mm x 296mm

Changed rectangle list to merge each monitor half:

[Rectangle {rect_x = 2160, rect_y = 584, rect_width = 3840, rect_height = 2160}, -- C, D
 Rectangle {rect_x = 0, rect_y = 0, rect_width = 2160, rect_height = 3840}]    -- A, B

Change in Operations.hs:

myFixed :: [Rectangle]
myFixed = [Rectangle {rect_x = 2160, rect_y = 584, rect_width = 3840, rect_height = 2160}, -- C, D
           Rectangle {rect_x = 0, rect_y = 0, rect_width = 2160, rect_height = 3840}]    -- A, B

-- | Cleans the list of screens according to the rules documented for
-- nubScreens.
getCleanedScreenInfo :: MonadIO m => Display -> m [Rectangle]
getCleanedScreenInfo = io .  fmap nubScreens . (const $ return myFixed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment