diff options
Diffstat (limited to 'plug/src/Config.hs')
| -rw-r--r-- | plug/src/Config.hs | 94 |
1 files changed, 12 insertions, 82 deletions
diff --git a/plug/src/Config.hs b/plug/src/Config.hs index 70920fd..0904ded 100644 --- a/plug/src/Config.hs +++ b/plug/src/Config.hs @@ -1,88 +1,18 @@ -module Config (config) where +module Config () where -import Control.Monad (unless) -import Data.Bits -import Data.Data (Proxy (Proxy)) -import Montis.Core.ButtonEvent as ButtonEvent -import Montis.Core.KeyEvent as KeyEvent -import Montis.Core.W -import Montis.Dsl.Bind -import Montis.Dsl.Input -import Montis.Keys.Macros -import Montis.Keys.MagicModifierKey -import Montis.Layout.Full -import Montis.Core.Runtime (requestHotReload) +import Montis.Core -config :: Config WindowLayout -config = - defaultConfig - { hooks = - defaultHooks - { surfaceHook = do - handleSurface - }, - layout = WindowLayout Full, - resetHook = do - useInputHandler $ - withProxies inputProxies $ do - ev <- nextInputEvent +foreign export ccall "plugin_cold_start" + coldStart :: MontisColdStart - bind ev (released btnLeft) $ - run $ - wio $ - putStrLn "Left Button Released!!" +foreign export ccall "plugin_hot_start" + hotStart :: MontisHotStart - unless (isPressEvent ev) $ do - forwardEvent ev - continue +coldStart :: MontisColdStart +coldStart = coldStartMontis config - bind ev (Shift .+ Mod1 .+ 'R') $ run requestHotReload +hotStart :: MontisHotStart +hotStart = hotStartMontis config - -- 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)} +config :: MontisConfig +config = defaultConfig |