diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-11-28 10:04:58 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-11-28 10:04:58 -0700 |
| commit | 2829111efd1e9274201020df313e1443c2877017 (patch) | |
| tree | 8e948a9c8f09670e721c8c27f8f579d32445cfb1 /src/Rahm/Desktop/Keys.hs | |
| parent | 367e73c9f82a7babc44390659acae878073bb9e4 (diff) | |
| download | rde-2829111efd1e9274201020df313e1443c2877017.tar.gz rde-2829111efd1e9274201020df313e1443c2877017.tar.bz2 rde-2829111efd1e9274201020df313e1443c2877017.zip | |
Change Swap to be instead a shift-and-follow.
Diffstat (limited to 'src/Rahm/Desktop/Keys.hs')
| -rw-r--r-- | src/Rahm/Desktop/Keys.hs | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index 91ce13a..b136c62 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -4,9 +4,11 @@ import Control.Monad ( filterM, forM_, unless, + when, ) import Control.Monad.Trans.Maybe - ( runMaybeT, + ( MaybeT (..), + runMaybeT, ) import Control.Monad.Writer ( WriterT, @@ -81,6 +83,7 @@ import Rahm.Desktop.Keys.Wml readNextWorkspace, readWindowsetMacro, readWorkspaceMacro, + workspaceName, ) import Rahm.Desktop.Layout (nLayouts) import Rahm.Desktop.Layout.ConsistentMosaic @@ -134,7 +137,8 @@ import Rahm.Desktop.Workspaces withScreen, ) import Rahm.Desktop.XMobarLog.PendingBuffer - ( pushAddPendingBuffer, + ( addStringToPendingBuffer, + pushAddPendingBuffer, pushPendingBuffer, ) import Text.Printf (printf) @@ -537,32 +541,23 @@ keymap = runKeys $ do sendMessage rotateLayout bind xK_s $ do - forM_ [(False, justMod), (True, shiftMod)] $ \(doSwap, f) -> + forM_ [(False, justMod), (True, shiftMod)] $ \(doView, f) -> f $ doc - ( if doSwap - then "Swap a windowset with another windowset." + ( if doView + then "Shift a windowset to a workspace and goto that workspace." else "Shift a windowset to a workspace" ) - $ pushPendingBuffer (if doSwap then "S " else "s ") $ do + $ pushPendingBuffer (if doView then "S " else "s ") $ do maybeLocs <- runMaybeT readNextLocationSet + addStringToPendingBuffer " " forM_ maybeLocs $ \locations -> do let locationWindows = mapMaybe locationWindow locations 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 + workspace <- readNextWorkspace + mapM_ (lift . moveLocationToWorkspaceFn workspace) locations lift $ setAlternateWindows locationWindows forM_ locations $ \loc -> @@ -571,6 +566,10 @@ keymap = runKeys $ do Just win -> do lift $ setAlternateWorkspace win (locationWorkspace loc) + wsName <- MaybeT $ return (workspaceName workspace) + when doView $ + lift $ windows $ W.greedyView wsName + altMod $ spawnX "sudo -A systemctl suspend && xsecurelock" bind xK_space $ do |