blob: 04d13c6d0b7c29ca7dbf2f8737061d40af0a2a71 (
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
51
52
53
54
55
|
module Config (config) where
import Control.Monad.IO.Class
import Control.Monad.Loops
import Wetterhorn.Core.KeyEvent qualified as KeyEvent
import Wetterhorn.Core.Keys
import Wetterhorn.Core.W
import Wetterhorn.Layout.Full
alsoLog :: KeyContinuation -> W ()
alsoLog kh =
putKeyHandler
( \ke -> do
liftIO $ putStrLn $ (: []) $ KeyEvent.codepoint ke
kh ke
)
config :: Config WindowLayout
config =
defaultConfig
{ hooks =
defaultHooks
{ surfaceHook = do
handleSurface
},
layout = WindowLayout Full,
resetHook = do
useKeysWithContinuation alsoLog $ do
kp <- nextKeyPress
bind kp (Mod1 .+ 'r') (shellExec "wofi --show run")
bind kp (Shift .+ Mod1 .+ 'R') requestHotReload
bind kp (Mod1 .+ 't') (shellExec "alacritty")
bind kp (weak $ Mod1 .+ '∫') (shellExec "gxmessage hi")
bind kp (Mod1 .+ 'p') $ do
str <-
unfoldM
( do
ke <- nextKeyPress
return $
if KeyEvent.codepoint ke == '\r'
then Nothing
else Just (KeyEvent.codepoint ke)
)
liftIO $ putStrLn $ "You input: " ++ str
bind kp (str == "hello") $ do
wio $ putStrLn "You Win! *\\o/*"
liftIO $ putStrLn "You lose :("
forwardEvent kp
}
|