aboutsummaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-03-27 17:14:59 -0600
committerJosh Rahm <rahm@google.com>2024-03-27 17:14:59 -0600
commit0a7f561f3821968605c16a03ea278e3611b6c775 (patch)
treef2a8e63262dd709163a0b620777072a97956f9ee /src/Config.hs
parent58857e81a97165541bbc83e63c589d904279c640 (diff)
downloadmontis-0a7f561f3821968605c16a03ea278e3611b6c775.tar.gz
montis-0a7f561f3821968605c16a03ea278e3611b6c775.tar.bz2
montis-0a7f561f3821968605c16a03ea278e3611b6c775.zip
Just a whole bunch of changes
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/Config.hs b/src/Config.hs
index 0bd0d43..e76e6ea 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -1,13 +1,15 @@
-{-# LANGUAGE DataKinds #-}
-
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
@@ -26,7 +28,8 @@ config =
bind ev (released btnLeft) $
run $
- wio $ putStrLn "Left Button Released!!"
+ wio $
+ putStrLn "Left Button Released!!"
unless (isPressEvent ev) $ do
forwardEvent ev
@@ -41,18 +44,45 @@ config =
bind ev2 (Mod1 .+ 'p') $
run $
- wio $ putStrLn "Test"
+ wio $
+ putStrLn "Test"
bind ev (Mod1 .+ btnLeft) $
run $
- wio $ putStrLn "Left Button Press!!"
+ 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, KeyLogger]
+ 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