diff options
| author | Josh Rahm <rahm@google.com> | 2024-02-06 16:45:31 -0700 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2024-02-06 16:45:31 -0700 |
| commit | e670c95c5696de6e57d297d30dff9391bba0e5ad (patch) | |
| tree | ad9a872d35204328f0cf1177ef31b21e916c32a7 | |
| parent | 3a5d965333bb2d7a115e4de05d88ada48fd1d677 (diff) | |
| download | rde-e670c95c5696de6e57d297d30dff9391bba0e5ad.tar.gz rde-e670c95c5696de6e57d297d30dff9391bba0e5ad.tar.bz2 rde-e670c95c5696de6e57d297d30dff9391bba0e5ad.zip | |
Change how history works. History will now not send the user to the hidden workspace, making it harder to explicitly go to the hidden workspace
| -rw-r--r-- | src/Rahm/Desktop/History.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Rahm/Desktop/History.hs b/src/Rahm/Desktop/History.hs index 01f3761..8b8e879 100644 --- a/src/Rahm/Desktop/History.hs +++ b/src/Rahm/Desktop/History.hs @@ -21,11 +21,11 @@ import qualified Data.Map as Map import Data.Maybe (catMaybes, fromMaybe, isJust) import Data.Sequence (Seq (..)) import qualified Data.Sequence as Seq (length, (!?)) -import Rahm.Desktop.Common (Location (Location), focusLocation, getCurrentScreen, getCurrentWorkspace, locationWorkspace) +import Rahm.Desktop.Common (Location (Location, locationWindow), focusLocation, getCurrentScreen, getCurrentWorkspace, locationWorkspace) import Rahm.Desktop.Hooks.WindowChange import Rahm.Desktop.Logger import Text.Printf (printf) -import XMonad (ExtensionClass (extensionType, initialValue), ScreenId, StateExtension (..), Window, X) +import XMonad (ExtensionClass (extensionType, initialValue), ScreenId, StateExtension (..), Window, X, withWindowSet) import XMonad.StackSet import qualified XMonad.Util.ExtensibleState as XS ( get, @@ -106,14 +106,21 @@ jumpToLastLocation = do logs Trace "Jumping to Last Location." mapM_ focusLocation =<< lastLocation --- Get the last location for the current screen. +-- Get the last location for the current screen. If lastLocation :: X (Maybe Location) lastLocation = do screenId <- getCurrentScreen ret <- getZipper . getCurrentZipper screenId <$> XS.get XS.modify $ \(History byScreen) -> History (Map.adjust popSeqZipper screenId byScreen) - return ret + + t <- withWindowSet $ \ws -> + return $ flip findTag ws =<< (locationWindow =<< ret) + + -- The last location should not return the last location. + if t == Just "*" || (locationWorkspace <$> ret) == Just "*" + then lastLocation + else return ret nextLocation :: X (Maybe Location) nextLocation = do |