aboutsummaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-03-05 18:20:43 -0700
committerJosh Rahm <rahm@google.com>2024-03-05 18:20:43 -0700
commitc50a8375cd37d054e68648c9116670d39a94fd34 (patch)
treeac59c94bc4cf4de1b89d79e4ed030b04ff35d9da /src/Config.hs
parent9a696c2b071dfecb691d16c66bfd00edd54c4beb (diff)
downloadmontis-c50a8375cd37d054e68648c9116670d39a94fd34.tar.gz
montis-c50a8375cd37d054e68648c9116670d39a94fd34.tar.bz2
montis-c50a8375cd37d054e68648c9116670d39a94fd34.zip
More flexing with the new keysM system.
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Config.hs b/src/Config.hs
index 9d090d6..759e3b8 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -1,5 +1,9 @@
module Config (config) where
+import Control.Monad.IO.Class
+import Control.Monad.Loops
+import Control.Monad.RWS (MonadReader (ask))
+import qualified Wetterhorn.Core.KeyEvent as KeyEvent
import Wetterhorn.Core.Keys
import Wetterhorn.Core.W
import Wetterhorn.Layout.Full
@@ -20,6 +24,22 @@ config =
bind 'l' $ wio $ putStrLn "lololololo"
bind 'j' $ wio $ putStrLn "JOGGING!"
+ subbind (Mod1 .+ 'p') $ do
+ str <-
+ unfoldM
+ ( do
+ ke <- ask
+ if KeyEvent.codepoint ke == '\r'
+ then return Nothing
+ else do
+ Just (KeyEvent.codepoint ke) <$ nextKeyPress
+ )
+
+ liftIO $ putStrLn $ "You input: " ++ str
+ bind (str == "hello") $ do
+ liftIO $ putStrLn "You Win! *\\o/*"
+ liftIO $ putStrLn "You Lose :("
+
forwardEvent,
surfaceHook = wio . print
},