Retrieving screen resolution + ghci for XMonad

Hi, I am trying to align a dzen2 bar to the right of my screen. A dzen2 bar is aligned by giving an offset from the left side of the screen. Since I have a single xmonad.hs for multiple computers, I would like to retrieve the width of the screen from XMonad. I found the following snippet online: main = do (_, out, _, process_handle) <- runInteractiveCommand "echo WIDTH | eval m4 `xrdb -symbols`" ... This does not seem really satisfactory. I know this information is available from inside XMonad, probably in a ScreenDetail from XMonad.Core. My question is: "How can I retrieve this number from XMonad?" Another way look at that the question is: "What is the best way to figure out things in XMonad?" I have a specific question, found a potential candidate in the documentation, and would like to experiment before changing my xmonad.hs. Is there a way to use ghci to look around? Thanks.

I did something similar here:
https://github.com/thomasf/dotfiles-thomasf-xmonad/blob/master/.xmonad/lib/X...
On Mon, Apr 2, 2012 at 16:16, Nicolas Dudebout
Hi,
I am trying to align a dzen2 bar to the right of my screen. A dzen2 bar is aligned by giving an offset from the left side of the screen. Since I have a single xmonad.hs for multiple computers, I would like to retrieve the width of the screen from XMonad. I found the following snippet online: main = do (_, out, _, process_handle) <- runInteractiveCommand "echo WIDTH | eval m4 `xrdb -symbols`" ... This does not seem really satisfactory. I know this information is available from inside XMonad, probably in a ScreenDetail from XMonad.Core.
My question is: "How can I retrieve this number from XMonad?"
Another way look at that the question is: "What is the best way to figure out things in XMonad?" I have a specific question, found a potential candidate in the documentation, and would like to experiment before changing my xmonad.hs. Is there a way to use ghci to look around?
Thanks.
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
-- Thomas Frössman http://t.jossystem.se

Quoting Nicolas Dudebout
My question is: "How can I retrieve this number from XMonad?"
Another way look at that the question is: "What is the best way to figure out things in XMonad?"
The best way is to look around the documentation. In particular, you'll like these ones for this questions: http://hackage.haskell.org/package/X11 http://hackage.haskell.org/packages/archive/X11/1.6.0/doc/html/Graphics-X11-... And these ones for future questions: http://hackage.haskell.org/package/xmonad http://hackage.haskell.org/package/xmonad-contrib When the documentation is insufficient... use the source. ;-) There are several other links here that you may like: http://xmonad.org/documentation.html Enjoy! ~d

Thank you for the pointers. However, this is exactly an instance of my problem. I now have some documentation and I would really like to be able to play with the functions I see. I would like to test the function `getScreenInfo`, but its input is a `Display` which I have no idea where to find. Is there any way to use the building blocks of XMonad in ghci for example?

Quoting Nicolas Dudebout
I would like to test the function `getScreenInfo`, but its input is a `Display` which I have no idea where to find.
You may get a Display from openDisplay: http://hackage.haskell.org/packages/archive/X11/1.6.0/doc/html/Graphics-X11-...
Is there any way to use the building blocks of XMonad in ghci for example?
It may be a bit tricky to play around with the building blocks of xmonad in ghci, because it's generally not a good idea to have two window managers running at once. However, if you really want to do this, you may at your own risk open up ghci, import XMonad, and be on your way. If you find that there are some functions you wish you had, but which are not exported by the appropriate library, you may navigate to your xmonad source directory and use ':l *XMonad' (or similar, with other module names) in ghci to bring all functions into scope. ~d
participants (3)
-
Nicolas Dudebout
-
Thomas Frössman
-
wagnerdm@seas.upenn.edu