aboutsummaryrefslogtreecommitdiff
path: root/plug/src/Config.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-01 18:04:40 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-01 18:04:40 -0700
commit628174c992a5a740feb4dc119adf8dfb1f89f992 (patch)
tree683361b27cf4b6df2c5cc782d70de9bdf5fd38a8 /plug/src/Config.hs
parentbe1ef8cee5f68eb9afecca94071069a1ff82825e (diff)
downloadmontis-628174c992a5a740feb4dc119adf8dfb1f89f992.tar.gz
montis-628174c992a5a740feb4dc119adf8dfb1f89f992.tar.bz2
montis-628174c992a5a740feb4dc119adf8dfb1f89f992.zip
Have Meson orchestrate the whole build rather than stack.
As a part of this, I changed the file layout to: rt/ - the Montis runtime plug/ - the Montis plugin wlroots/ - wlroots
Diffstat (limited to 'plug/src/Config.hs')
-rw-r--r--plug/src/Config.hs88
1 files changed, 88 insertions, 0 deletions
diff --git a/plug/src/Config.hs b/plug/src/Config.hs
new file mode 100644
index 0000000..e76e6ea
--- /dev/null
+++ b/plug/src/Config.hs
@@ -0,0 +1,88 @@
+module Config (config) where
+
+import Control.Monad (unless)
+import Data.Bits
+import Data.Data (Proxy (Proxy))
+import Wetterhorn.Core.ButtonEvent as ButtonEvent
+import Wetterhorn.Core.KeyEvent as KeyEvent
+import Wetterhorn.Core.W
+import Wetterhorn.Dsl.Bind
+import Wetterhorn.Dsl.Input
+import Wetterhorn.Keys.Macros
+import Wetterhorn.Keys.MagicModifierKey
+import Wetterhorn.Layout.Full
+
+config :: Config WindowLayout
+config =
+ defaultConfig
+ { hooks =
+ defaultHooks
+ { surfaceHook = do
+ handleSurface
+ },
+ layout = WindowLayout Full,
+ resetHook = do
+ useInputHandler $
+ withProxies inputProxies $ do
+ ev <- nextInputEvent
+
+ bind ev (released btnLeft) $
+ run $
+ wio $
+ putStrLn "Left Button Released!!"
+
+ unless (isPressEvent ev) $ do
+ forwardEvent ev
+ continue
+
+ bind ev (Shift .+ Mod1 .+ 'R') $ run requestHotReload
+
+ bind ev (Mod1 .+ 't') $ run (shellExec "alacritty")
+
+ bind ev (Mod1 .+ 'p') $ do
+ ev2 <- nextInputPressEvent
+
+ bind ev2 (Mod1 .+ 'p') $
+ run $
+ wio $
+ putStrLn "Test"
+
+ bind ev (Mod1 .+ btnLeft) $
+ run $
+ wio $
+ putStrLn "Left Button Press!!"
+
+ bind ev (Mod1 .+ 'q') macroStartStopKeybind
+
+ bind ev (weak $ Mod1 .+ '@') macroReplayKeybind
+
+ bind ev (weak $ ModX 5 .+ btnLeft) $
+ run $
+ wio $
+ putStrLn "Fake Modifier With Button!!!"
+
+ bind ev (weak $ ModX 5 .+ 't') $
+ run $
+ wio $
+ putStrLn "Fake Modifier!!"
+
+ forwardEvent ev
+ }
+ where
+ inputProxies ::
+ Proxy
+ '[ MacroSupport,
+ MagicModifierProxy 59 SetXtra -- Only log keys when F1 (keycode 59 is pressed)
+ ]
+ inputProxies = Proxy
+
+data SetXtra
+
+instance InputProxy SetXtra where
+ onKeyEvent _ ie =
+ case ie of
+ (InputKeyEvent ke@(KeyEvent {KeyEvent.modifiers = modifiers})) ->
+ return $ InputKeyEvent ke {KeyEvent.modifiers = modifiers .|. modifierToMask (ModX 5)}
+ (InputButtonEvent be@(ButtonEvent {ButtonEvent.modifiers = modifiers})) ->
+ return $ InputButtonEvent be {ButtonEvent.modifiers = modifiers .|. modifierToMask (ModX 5)}
+ _ -> return ie