aboutsummaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-03-21 16:34:22 -0600
committerJosh Rahm <rahm@google.com>2024-03-21 16:34:22 -0600
commit211fce2128121f3c9374442a13c5d756182a7cb1 (patch)
tree3db70b03f270d9ac9a4cac700e4bf21be33d8af1 /src/Config.hs
parent15a7989977afaebd63e0d87a6eb1aeb735feddde (diff)
downloadmontis-211fce2128121f3c9374442a13c5d756182a7cb1.tar.gz
montis-211fce2128121f3c9374442a13c5d756182a7cb1.tar.bz2
montis-211fce2128121f3c9374442a13c5d756182a7cb1.zip
Implement more stuff. Add DSL for binding to the new input handler.
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs53
1 files changed, 20 insertions, 33 deletions
diff --git a/src/Config.hs b/src/Config.hs
index 5f09cbe..dab514b 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -1,13 +1,14 @@
module Config (config) where
-import Text.Printf
import Control.Monad.IO.Class
import Control.Monad.Loops
-import Wetterhorn.Core.KeyEvent qualified as KeyEvent
-import Wetterhorn.Core.Keys
+import Text.Printf
import Wetterhorn.Core.W
+import Wetterhorn.Dsl.Bind
+import Wetterhorn.Dsl.Input
import Wetterhorn.Keys.Macros
import Wetterhorn.Layout.Full
+import Control.Monad (unless)
config :: Config WindowLayout
config =
@@ -19,42 +20,28 @@ config =
},
layout = WindowLayout Full,
resetHook = do
- useKeysWithContinuation recordMacroContinuation $ do
- ev <- nextButtonOrKeyPress
-
- case ev of
- Right kp -> do
- bind kp (Mod1 .+ 'q') macroKeyBind
-
- bind kp (weak $ Mod1 .+ '@') replayMacroKeybind
+ useInputHandler $ do
+ ev <- nextInputEvent
- bind kp (Mod1 .+ 'r') (shellExec "wofi --show run")
+ bind ev (released btnLeft) $ do
+ wio $ putStrLn "Left Button Released!!"
- bind kp (Shift .+ Mod1 .+ 'R') requestHotReload
+ unless (isPressEvent ev) $ do
+ forwardEvent ev
+ continue
- bind kp (Mod1 .+ 't') (shellExec "alacritty")
+ bind ev (Shift .+ Mod1 .+ 'R') requestHotReload
- bind kp (Mod1 .+ 'n') (return () :: W ())
+ bind ev (Mod1 .+ 't') (shellExec "alacritty")
- bind kp (weak $ Mod1 .+ '∫') (shellExec "gxmessage hi")
+ bind ev (Mod1 .+ 'p') $ do
+ ev2 <- nextInputPressEvent
- 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 ev2 (Mod1 .+ 'p') $ do
+ wio $ putStrLn "Test"
- forwardEvent kp
+ bind ev (Mod1 .+ btnLeft) $ do
+ wio $ putStrLn "Left Button Press!!"
- Left but ->
- liftIO $ putStrLn $ "ButtonEvent! " ++ (show but)
+ forwardEvent ev
}