diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-04-24 21:37:30 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:46 -0600 |
| commit | 2718bff92696b3e563456c35c3606179cf7c9060 (patch) | |
| tree | 8bdc620e5920bc501e8c8fb2a6c18fc9788bfc33 /src/Rahm/Desktop/StackSet.hs | |
| parent | b80d487285cf7dd05075de4dc2fa669a703016b0 (diff) | |
| download | rde-2718bff92696b3e563456c35c3606179cf7c9060.tar.gz rde-2718bff92696b3e563456c35c3606179cf7c9060.tar.bz2 rde-2718bff92696b3e563456c35c3606179cf7c9060.zip | |
Add M-S-s to swap windows with eachother
Diffstat (limited to 'src/Rahm/Desktop/StackSet.hs')
| -rw-r--r-- | src/Rahm/Desktop/StackSet.hs | 11 |
1 files changed, 5 insertions, 6 deletions
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 |