From 96c8d655adbb3ecc93597365657bb47695e5fb10 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 8 Jun 2022 10:29:04 -0600 Subject: Change up the override keys for browsers --- src/Rahm/Desktop/Keys.hs | 55 +++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 26 deletions(-) (limited to 'src/Rahm/Desktop/Keys.hs') diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index ab72645..b57d310 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -839,9 +839,29 @@ windowSpecificBindings config = do w <- lift ask + let mods = permuteMods [shiftMask, controlMask, 0] let configureIf b k = tell =<< lift (b --> return (keyBindingToKeymap (runKeys k) config)) emitKey = flip sendKey w + configureIf (flip elem (browsers ++ spotify) <$> className) $ do + + bind xK_h $ do + rawMask controlMask $ emitKey (0, xK_BackSpace) + forM_ mods $ \mask -> + rawMask (altMask .|. mask) $ emitKey (mask, xK_Left) + + bind xK_t $ + forM_ mods $ \mask -> + rawMask (altMask .|. mask) $ emitKey (mask, xK_Down) + + bind xK_c $ + forM_ mods $ \mask -> + rawMask (altMask .|.mask) $ emitKey (mask, xK_Up) + + bind xK_n $ + forM_ mods $ \mask -> + rawMask (altMask .|. mask) $ emitKey (mask, xK_Right) + configureIf (flip elem browsers <$> className) $ do -- if the window is a browser, configure these bindings. Lots of browsers @@ -865,25 +885,6 @@ windowSpecificBindings config = do -- Ctrl+d -> Delete current tab. - let mods = permuteMods [shiftMask, controlMask, 0] - - bind xK_h $ do - rawMask controlMask $ emitKey (0, xK_BackSpace) - forM_ mods $ \mask -> - rawMask (altMask .|. mask) $ emitKey (mask, xK_Left) - - bind xK_j $ - forM_ mods $ \mask -> - rawMask (altMask .|. mask) $ emitKey (mask, xK_Down) - - bind xK_k $ - forM_ mods $ \mask -> - rawMask (altMask .|.mask) $ emitKey (mask, xK_Up) - - bind xK_l $ - forM_ mods $ \mask -> - rawMask (altMask .|. mask) $ emitKey (mask, xK_Right) - bind xK_u $ rawMask controlMask $ emitKey (controlMask .|. shiftMask, xK_BackSpace) @@ -891,20 +892,21 @@ windowSpecificBindings config = do rawMask controlMask $ emitKey (controlMask, xK_BackSpace) bind xK_b $ do - rawMask controlMask $ emitKey (controlMask, xK_Left) - rawMask (controlMask .|. shiftMask) $ + rawMask altMask $ emitKey (controlMask, xK_Left) + rawMask (altMask .|. shiftMask) $ emitKey (controlMask .|. shiftMask, xK_Left) bind xK_e $ do - rawMask controlMask $ emitKey (controlMask, xK_Right) - rawMask (controlMask .|. shiftMask) $ + rawMask altMask $ emitKey (controlMask, xK_Right) + rawMask (altMask .|. shiftMask) $ emitKey (controlMask .|. shiftMask, xK_Right) bind xK_dollar $ - rawMask controlMask $ emitKey (0, xK_End) + rawMask altMask $ emitKey (0, xK_End) - bind xK_at $ - rawMask (controlMask .|. shiftMask) $ emitKey (0, xK_Home) + bind xK_at $ do + rawMask (altMask .|. shiftMask) $ emitKey (shiftMask, xK_Home) + rawMask altMask $ emitKey (0, xK_Home) bind xK_d $ rawMask controlMask $ emitKey (controlMask, xK_Tab) @@ -926,6 +928,7 @@ windowSpecificBindings config = do where browsers = ["Google-chrome", "Brave-browser", "firefox-default"] + spotify = ["Spotify"] -- Create a permutation from a list of modifiers. -- -- cgit