diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-04-24 21:37:30 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-04-24 21:37:30 -0600 |
| commit | 9b60476c272d5a9dd8cce4b811c2da6ee4a203aa (patch) | |
| tree | 8bdc620e5920bc501e8c8fb2a6c18fc9788bfc33 /src/Rahm/Desktop/Keys.hs | |
| parent | 07252ce0461d8746481881dbcc6ca07b71fd8553 (diff) | |
| download | rde-9b60476c272d5a9dd8cce4b811c2da6ee4a203aa.tar.gz rde-9b60476c272d5a9dd8cce4b811c2da6ee4a203aa.tar.bz2 rde-9b60476c272d5a9dd8cce4b811c2da6ee4a203aa.zip | |
Add M-S-s to swap windows with eachother
Diffstat (limited to 'src/Rahm/Desktop/Keys.hs')
| -rw-r--r-- | src/Rahm/Desktop/Keys.hs | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index 8cb2b76..50b7104 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -404,22 +404,34 @@ keymap = runKeys $ do sendMessage rotateLayout bind xK_s $ do - justMod $ do - locations <- fromMaybe [] <$> runMaybeT readNextLocationSet - let locationWindows = mapMaybe locationWindow locations - - withBorderWidth 4 locationWindows $ - withBorderColor "#00ffff" locationWindows $ do - runMaybeT_ $ do - workspace <- readNextWorkspace - mapM_ (lift . moveLocationToWorkspaceFn workspace) locations - - lift $ setAlternateWindows locationWindows - forM_ locations $ \loc -> - case locationWindow loc of - Nothing -> return () - Just win -> do - lift $ setAlternateWorkspace win (locationWorkspace loc) + forM_ [(False, justMod), (True, shiftMod)] $ \(doSwap, f) -> + f $ + doc (if doSwap + then "Swap a windowset with another windowset." + else "Shift a windowset to a workspace") $ do + locations <- fromMaybe [] <$> runMaybeT readNextLocationSet + let locationWindows = mapMaybe locationWindow locations + + withBorderWidth 4 locationWindows $ + withBorderColor "#00ffff" locationWindows $ do + runMaybeT_ $ do + if doSwap + then do + otherWindows <- + lift $ mapMaybe locationWindow . fromMaybe [] <$> + runMaybeT readNextLocationSet + lift $ windows $ + W.swapWindows (zip locationWindows otherWindows) + else do + workspace <- readNextWorkspace + mapM_ (lift . moveLocationToWorkspaceFn workspace) locations + + lift $ setAlternateWindows locationWindows + forM_ locations $ \loc -> + case locationWindow loc of + Nothing -> return () + Just win -> do + lift $ setAlternateWorkspace win (locationWorkspace loc) altMod $ spawnX "sudo -A systemctl suspend && xsecurelock" |