diff options
| author | Josh Rahm <rahm@google.com> | 2024-03-19 17:40:37 -0600 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2024-03-19 17:42:39 -0600 |
| commit | 86d91d7032f2d8175fd1ab3b23ee0c1a6445fb7a (patch) | |
| tree | cf0ff519a044a9166d0b508920702c11f40b9e14 /src/Config.hs | |
| parent | 103583fd20066b6da829db5c6a72c81e265f0fa4 (diff) | |
| download | montis-86d91d7032f2d8175fd1ab3b23ee0c1a6445fb7a.tar.gz montis-86d91d7032f2d8175fd1ab3b23ee0c1a6445fb7a.tar.bz2 montis-86d91d7032f2d8175fd1ab3b23ee0c1a6445fb7a.zip | |
Implementing button presses and integrating it with the KeysM monad.
Diffstat (limited to 'src/Config.hs')
| -rw-r--r-- | src/Config.hs | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/Config.hs b/src/Config.hs index e71f48a..5f09cbe 100644 --- a/src/Config.hs +++ b/src/Config.hs @@ -20,36 +20,41 @@ config = layout = WindowLayout Full, resetHook = do useKeysWithContinuation recordMacroContinuation $ do - kp <- nextKeyPress + ev <- nextButtonOrKeyPress - bind kp (Mod1 .+ 'q') macroKeyBind + case ev of + Right kp -> do + bind kp (Mod1 .+ 'q') macroKeyBind - bind kp (weak $ Mod1 .+ '@') replayMacroKeybind + bind kp (weak $ Mod1 .+ '@') replayMacroKeybind - bind kp (Mod1 .+ 'r') (shellExec "wofi --show run") + bind kp (Mod1 .+ 'r') (shellExec "wofi --show run") - bind kp (Shift .+ Mod1 .+ 'R') requestHotReload + bind kp (Shift .+ Mod1 .+ 'R') requestHotReload - bind kp (Mod1 .+ 't') (shellExec "alacritty") + bind kp (Mod1 .+ 't') (shellExec "alacritty") - bind kp (Mod1 .+ 'n') (return () :: W ()) + bind kp (Mod1 .+ 'n') (return () :: W ()) - bind kp (weak $ Mod1 .+ '∫') (shellExec "gxmessage hi") + 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 :(" + 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 + forwardEvent kp + + Left but -> + liftIO $ putStrLn $ "ButtonEvent! " ++ (show but) } |