From 8e168883155a61d98bdeb6782515231f962a02b5 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 18 Dec 2023 05:30:47 -0700 Subject: Add ability to add a hole to the layout. Doesn't work perfectly. --- src/Rahm/Desktop/Keys.hs | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/Rahm/Desktop/Keys.hs') diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index 8945201..9b72494 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -675,6 +675,25 @@ bindings = do altMod $ spawnX "sudo -A systemctl suspend && xsecurelock" + bind xK_x $ do + shiftMod $ + doc "Reset the holes" $ do + logs Debug "reset hole" + sendMessage resetHole + logs Debug "/reset hole" + + justMod $ + doc "Add hole next to the current window" $ do + logs Debug "Add hole" + withFocused $ \foc -> + withWindowSet $ \ws -> do + logs Debug "/Add hole at %s" (show foc) + whenJust (W.windowTilePosition foc ws) $ \tp -> do + logs Debug "Tile position: %s" (show tp) + (X.broadcastMessage . addHole) tp + refresh + logs Debug "/Add hole" + bind xK_space $ do justMod $ doc "Layout-related bindings" $ @@ -719,12 +738,10 @@ bindings = do doc "Jump to the middle layout." $ sendMessage (toIndexedLayout (nLayouts `div` 2)) - bind xK_x $ - (noMod -|- justMod) $ - doc "Toggle the hole" $ do - logs Debug "reset hole" - sendMessage resetHole - logs Debug "/reset hole" + bind xK_x $ do + justMod $ + doc "Toggles respect for struts." $ + sendMessage ToggleStruts bind xK_g $ (noMod -|- justMod) @@ -777,11 +794,6 @@ bindings = do doc "Spawn a floating terminal" $ spawnX =<< asks ((++ " -t Floating\\ Term") . terminal . config) - bind xK_x $ do - justMod $ - doc "Toggles respect for struts." $ - sendMessage ToggleStruts - bind xK_z $ do justMod $ doc "Less often used keybindings." $ -- cgit