Finding the number of X11 screens from Haskell

后端 未结 2 1515
南旧
南旧 2021-01-15 03:00

I\'d like to know how many X screens the current machine has, to make my .xmonad a little more general; I have a netbook as well as a desktop with two monitors, and I use se

相关标签:
2条回答
  • 2021-01-15 03:23

    For the curious, I ended up using

     screenCount :: X Int  
     screenCount = withDisplay (io.fmap length.getScreenInfo)
    

    I also found out that the XMonad module has a function

     screenCount :: Display -> Foreign.C.Types.CInt
    
    0 讨论(0)
  • 2021-01-15 03:24

    If you use the X11 package:

     import Graphics.X11.Xinerama (getScreenInfo)
    

    that will dynamically return a list of Rectangles, telling you how many screens, and their dimensions.

    0 讨论(0)
提交回复
热议问题