aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-04-12 19:10:27 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:46 -0600
commit85310f18ac936032ea8eb4e3e177684d2d738b7c (patch)
treec660d7e461d8aa8baf82e26a218827af37a2de94 /src/Rahm
parent0176bd3412a98db36ab2339e8c3425e6a2f59746 (diff)
downloadrde-85310f18ac936032ea8eb4e3e177684d2d738b7c.tar.gz
rde-85310f18ac936032ea8eb4e3e177684d2d738b7c.tar.bz2
rde-85310f18ac936032ea8eb4e3e177684d2d738b7c.zip
Replace submap and friends with my own versions that do the timeout.
Diffstat (limited to 'src/Rahm')
-rw-r--r--src/Rahm/Desktop/Submap.hs16
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