about summary refs log tree commit diff
path: root/src/Test.hs
blob: eea5d611d7c628f3794e1ee5bde72edd6af9f1fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module Main where

import Control.Monad (void)
import qualified Data.Map as M
import qualified Data.Set as S
import XMonad
import XMonad.Prompt
import XMonad.StackSet (new)
import XMonad.Util.EZConfig (checkKeymap)
import XMonad.Util.Font
import XMonad.Custom.Bindings (rawKeys)
import XMonad.Custom.Theme (promptTheme)

main :: IO ()
main = do
    dpy   <- openDisplay ""
    rootw <- rootWindow dpy $ defaultScreen dpy

    let xmc = def {layoutHook = Layout $ layoutHook def}
        initialWinset = new (layoutHook xmc) (workspaces xmc) []

    let cf = XConf { display       = dpy
                   , config        = xmc
                   , theRoot       = rootw
                   , normalBorder  = 0
                   , focusedBorder = 0
                   , keyActions    = M.empty
                   , buttonActions = M.empty
                   , mouseFocused  = False
                   , mousePosition = Nothing
                   , currentEvent  = Nothing
                   }

    let st = XState { windowset       = initialWinset
                    , numberlockMask  = 0
                    , mapped          = S.empty
                    , waitingUnmap    = M.empty
                    , dragging        = Nothing
                    , extensibleState = M.empty
                    }

    void $ runX cf st $ do
        checkKeymap xmc (rawKeys xmc)

        xmf <- initXMF (font promptTheme)

        case xmf of
            Core _ -> io (putStrLn "Font: core")
            Utf8 _ -> io (putStrLn "Font: utf8")
            Xft  _ -> io (putStrLn "Font: xft")

Consider giving Nix/NixOS a try! <3