diff options
Diffstat (limited to 'src/Config.hs')
| -rw-r--r-- | src/Config.hs | 42 |
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 |