From e670c95c5696de6e57d297d30dff9391bba0e5ad Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 6 Feb 2024 16:45:31 -0700 Subject: 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 --- src/Rahm/Desktop/History.hs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/Rahm/Desktop') 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 -- cgit