From 4c14fed7b852296af422a9d2f7166abced2c52b9 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 13 Dec 2023 16:48:10 -0700 Subject: Added documentation ability for Dsl2 keys. --- src/Rahm/Desktop/Keys.hs | 53 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'src/Rahm/Desktop/Keys.hs') diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index 412d8f5..8945201 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -306,33 +306,26 @@ bindings = do doc "Move XMobar to another screen." $ spawnX "pkill -SIGUSR1 xmobar" - -- bind xK_F1 $ do - -- justMod $ - -- doc - -- "Print this documentation" - -- ( safeSpawn - -- "gxmessage" - -- [ "-fn", - -- "Source Code Pro", - -- "Key Bindings\n\n" - -- ++ documentation (keymap config) - -- ++ "\n\nButton Bindings\n\n" - -- ++ buttonDocumentation (mouseMap config) - -- ] :: - -- X () - -- ) - - -- bind xK_F7 $ do - -- justMod $ - -- doc - -- "Print this documentation to stdout (at LogLevel Info)" - -- ( logs - -- Info - -- "KeyBindings\n\n%s\n\nButtonBindings\n\n%s" - -- (documentation (keymap config)) - -- (buttonDocumentation (mouseMap config)) :: - -- X () - -- ) + let getDoc :: X String + getDoc = do + config <- asks config + return $ + "Key and Mouse Bindings:\n\n" + ++ documentation config bindings + + bind xK_F1 $ do + justMod + $ doc + "Print this documentation" + $ do + doc <- getDoc + safeSpawn "gxmessage" ["-fn", "Source Code Pro", doc] + + bind xK_F7 $ do + justMod $ + doc + "Print this documentation to stdout (at LogLevel Info)" + (logs Info "%s" =<< getDoc) bind xK_F10 $ do justMod playPauseDoc @@ -846,6 +839,12 @@ bindings = do noMod mediaNextDoc rawMask shiftMask mediaSeekFDoc + bindOtherKeys $ \(_, _, s) -> + logs Info "Unhandled key pressed: %s" s + + bindOtherButtons $ \(_, b) -> + logs Info "Unhandled button press: %s" (show b) + -- Centers the current focused window. i.e. toggles the Zoom layout -- modifier. shiftMod $ -- cgit