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