Peter's XMonad configuration files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

checkrc.hs 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. --------------------------------------------------------------------------------
  2. {- This file is part of the xmonadrc package. It is subject to the
  3. license terms in the LICENSE file found in the top-level directory of
  4. this distribution and at git://pmade.com/xmonadrc/LICENSE. No part of
  5. the xmonadrc package, including this file, may be copied, modified,
  6. propagated, or distributed except according to the terms contained in
  7. the LICENSE file. -}
  8. --------------------------------------------------------------------------------
  9. -- | Check parts of my XMonad configuration, like key bindings.
  10. module Main where
  11. --------------------------------------------------------------------------------
  12. import Control.Monad (void, unless)
  13. import qualified Data.Map as M
  14. import qualified Data.Set as S
  15. import Graphics.X11
  16. import Graphics.X11.Xinerama
  17. import Graphics.X11.Xrandr
  18. import XMonad
  19. import XMonad.Prompt
  20. import XMonad.StackSet (new)
  21. import XMonad.Util.EZConfig (checkKeymap)
  22. import XMonad.Util.Font
  23. --------------------------------------------------------------------------------
  24. import XMonad.Local.Keys (rawKeys)
  25. import XMonad.Local.Prompt (promptConfig)
  26. --------------------------------------------------------------------------------
  27. main :: IO ()
  28. main = do
  29. dpy <- openDisplay ""
  30. rootw <- rootWindow dpy $ defaultScreen dpy
  31. let xmc = def {layoutHook = Layout $ layoutHook def, modMask = mod3Mask}
  32. initialWinset = new (layoutHook xmc) (workspaces xmc) []
  33. let cf = XConf { display = dpy
  34. , config = xmc
  35. , theRoot = rootw
  36. , normalBorder = 0
  37. , focusedBorder = 0
  38. , keyActions = M.empty
  39. , buttonActions = M.empty
  40. , mouseFocused = False
  41. , mousePosition = Nothing
  42. , currentEvent = Nothing
  43. }
  44. let st = XState { windowset = initialWinset
  45. , numberlockMask = 0
  46. , mapped = S.empty
  47. , waitingUnmap = M.empty
  48. , dragging = Nothing
  49. , extensibleState = M.empty
  50. }
  51. void $ runX cf st $ do
  52. -- Check key bindings, errors go to xmessage.
  53. checkKeymap xmc (rawKeys xmc)
  54. -- Make sure font rendering works.
  55. xmf <- initXMF (font promptConfig)
  56. case xmf of
  57. Core _ -> io (putStrLn "Font: core")
  58. Utf8 _ -> io (putStrLn "Font: utf8")
  59. Xft _ -> io (putStrLn "Font: xft")
  60. -- Test for XRandR support.
  61. unless compiledWithXrandr (error "no XRandR support!")
  62. io $ putStrLn ("Screens: " ++ show (screenCount dpy))
  63. io (getScreenInfo dpy >>= putStrLn . show)