diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-04-12 19:10:27 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-04-12 19:10:27 -0600 |
| commit | cbe073ecee5a5a0230f2223bd90c2fdacce06892 (patch) | |
| tree | c660d7e461d8aa8baf82e26a218827af37a2de94 /src | |
| parent | 7d47e54beafbd0463e1dcf25c80511342cb6daaa (diff) | |
| download | rde-cbe073ecee5a5a0230f2223bd90c2fdacce06892.tar.gz rde-cbe073ecee5a5a0230f2223bd90c2fdacce06892.tar.bz2 rde-cbe073ecee5a5a0230f2223bd90c2fdacce06892.zip | |
Replace submap and friends with my own versions that do the timeout.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Rahm/Desktop/Submap.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/Rahm/Desktop/Submap.hs b/src/Rahm/Desktop/Submap.hs index 5dc6fb0..2306ee6 100644 --- a/src/Rahm/Desktop/Submap.hs +++ b/src/Rahm/Desktop/Submap.hs @@ -5,7 +5,9 @@ module Rahm.Desktop.Submap ( nextButton, nextMotion, nextMotionOrButton, - module X) where + submap, + submapDefault, + submapDefaultWithKey) where import XMonad hiding (keys) import Control.Monad.Fix (fix) @@ -14,8 +16,6 @@ import Data.Map (Map) import Control.Concurrent (threadDelay) import Data.Word (Word64) -import XMonad.Actions.Submap as X - getMaskEventWithTimeout :: Int -> Display -> Word64 -> (XEventPtr -> IO a) -> IO (Maybe a) @@ -74,6 +74,16 @@ mapNextStringWithKeysym fn = do mapNextString :: (KeyMask -> String -> X ()) -> X () mapNextString fn = mapNextStringWithKeysym (\m _ s -> fn m s) +submapDefaultWithKey :: ((KeyMask, KeySym) -> X ()) -> Map (KeyMask, KeySym) (X ()) -> X () +submapDefaultWithKey def m = mapNextStringWithKeysym $ \mask sym _ -> do + Map.findWithDefault (def (mask, sym)) (mask, sym) m + +submapDefault :: X () -> Map (KeyMask, KeySym) (X ()) -> X () +submapDefault def = submapDefaultWithKey (const def) + +submap :: Map (KeyMask, KeySym) (X ()) -> X () +submap = submapDefault (return ()) + {- Grabs the mouse and returns the next button press. -} nextButton :: X (ButtonMask, Button) nextButton = do |