From 9b60476c272d5a9dd8cce4b811c2da6ee4a203aa Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Sun, 24 Apr 2022 21:37:30 -0600 Subject: Add M-S-s to swap windows with eachother --- src/Rahm/Desktop/StackSet.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/Rahm/Desktop/StackSet.hs') diff --git a/src/Rahm/Desktop/StackSet.hs b/src/Rahm/Desktop/StackSet.hs index 652dafe..6b90fab 100644 --- a/src/Rahm/Desktop/StackSet.hs +++ b/src/Rahm/Desktop/StackSet.hs @@ -46,12 +46,11 @@ mapWindows fn (StackSet cur vis hid float) = mapWindowsWorkspace (Workspace t l stack) = Workspace t l (fmap (fmap fn) stack) -swapWindows :: (Ord a) => a -> a -> StackSet i l a s d -> StackSet i l a s d -swapWindows wa wb = mapWindows $ \w -> - case w of - _ | w == wa -> wb - _ | w == wb -> wa - _ -> w +swapWindows :: (Ord a) => [(a, a)] -> StackSet i l a s d -> StackSet i l a s d +swapWindows toSwap = mapWindows $ \w -> + fromMaybe w (Map.lookup w toSwapM) + where + toSwapM = Map.fromList (toSwap ++ map (\(a, b) -> (b, a)) toSwap) masterWindow :: StackSet i l a s sd -> Maybe a masterWindow = head . integrate' . stack . workspace . current -- cgit