Get width and height of current screen ?

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.

On Thu, Dec 8, 2016 at 2:49 AM,
I have yet to successfully look inside the stackSet. I can tell that I'm not getting something that is very fundamental.
Somewhere in a do block in X: rect <- fmap (W.screenRect . W.screenDetail . current) (gets windowset) (the type of this is http://hackage.haskell.org/package/X11-1.6.1.2/docs/Graphics-X11-Xlib-Types.... ) Also, you need to have imported the StackSet stuff properly: import qualified XMonad.StackSet as W The StackSet type is heavily parameterized because sjanssen ran the XMonad.StackSet module through a code verifier which couldn't handle the X11 types, so substituted basic types for them instead. http://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Core.html#t:Windo... is the actual type of what we normally refer to as the StackSet. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Thank you that makes more sense. I do have
import qualified XMonad.StackSet as W
But everything makes more sense now that I'm looking at XMonad.Core.
I'm also still struggling with monads and all the types.
That might take me bit of time. XMonad may not be the best way
to learn Haskell...
Brandon Allbery
On Thu, Dec 8, 2016 at 2:49 AM,
wrote: I have yet to successfully look inside the stackSet. I can tell that I'm not getting something that is very fundamental.
Somewhere in a do block in X:
rect <- fmap (W.screenRect . W.screenDetail . current) (gets windowset)
(the type of this is http://hackage.haskell.org/package/X11-1.6.1.2/docs/Graphics-X11-Xlib-Types.... )
Also, you need to have imported the StackSet stuff properly:
import qualified XMonad.StackSet as W
The StackSet type is heavily parameterized because sjanssen ran the XMonad.StackSet module through a code verifier which couldn't handle the X11 types, so substituted basic types for them instead. http://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Core.html#t:Windo... is the actual type of what we normally refer to as the StackSet.

On Thu, Dec 8, 2016 at 4:19 AM,
XMonad may not be the best way to learn Haskell...
It's actually a rather poor way to learn Haskell: programs tend to be sitting very close to the Xlib API, and usually end up looking like a "translation" of C to Haskell instead of like idiomatic Haskell code. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (2)
-
Brandon Allbery
-
e.a.gebhart@gmail.com