[xmonad] Get width and height of current screen ?

e.a.gebhart at gmail.com e.a.gebhart at gmail.com
Thu Dec 8 02:49:15 UTC 2016


I know the information is there but I don't have sufficient Haskell
skills to figure it out yet. I've only been using Xmonad for about 6
months.

I've seen the information in the StackSet doc, and I can also see it
in prelude with this:

   Graphics.X11.openDisplay [] >>= Graphics.X11.Xinerama.getScreenInfo
   [Rectangle {rect_x = 0, rect_y = 0, rect_width = 3440, rect_height = 1440}]

I have yet to successfully look inside the stackSet. I can tell that I'm not getting
something that is very fundamental.

I have this submap that I use mostly to move my scratchpads around.
It works great but I would like to set the width and height according to
the height and width of the current screen.

floatKeymap =
    [ ("g",  withFocused (keysMoveWindowTo  (0,40) (0,0))) -- Top Left
    , ("c",  withFocused (keysMoveWindowTo  (halfWidth, 40) (1%2, 0))) -- Top Center
    , ("r",  withFocused (keysMoveWindowTo  (screenWidth, 40) (1,0))) -- Top Right
    , ("h",  withFocused (keysMoveWindowTo  (0, halfHeight) (0, 1%2))) -- Left Center
    , ("t",  withFocused (keysMoveWindowTo  (halfWidth, halfHeight) (1%2, 1%2))) -- Center
    , ("n",  withFocused (keysMoveWindowTo  (screenWidth, halfHeight) (1, 1%2))) -- Right Center
    , ("m",  withFocused (keysMoveWindowTo  (0, screenHeight) (0,1))) -- Bottom Left
    , ("w",  withFocused (keysMoveWindowTo  (halfWidth, screenHeight) (1%2, 1))) -- Bottom Center
    , ("v",  withFocused (keysMoveWindowTo  (screenWidth, screenHeight) (1,1))) -- BottomRight
    ] where
         screenWidth = 3440
         screenHeight = 1440
         halfWidth = div screenWidth 2
         halfHeight = div screenHeight 2


I would appreciate any pointers that would help me
understand and figure this out.


More information about the xmonad mailing list