From c92cd07aaf7c54cd528166fc46dbade8008f5392 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 13 Apr 2022 18:29:27 -0600 Subject: [WIP] Working on better workspaces --- src/Rahm/Desktop/Marking.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Rahm/Desktop/Marking.hs') diff --git a/src/Rahm/Desktop/Marking.hs b/src/Rahm/Desktop/Marking.hs index 8ca50fd..1144ad7 100644 --- a/src/Rahm/Desktop/Marking.hs +++ b/src/Rahm/Desktop/Marking.hs @@ -94,7 +94,7 @@ instance ExtensionClass MarkState where changeHistory :: (History Spot -> History Spot) -> (MarkState -> MarkState) changeHistory fn ms = ms { windowHistory = fn (windowHistory ms)} -withMaybeFocused :: (Maybe Window -> X ()) -> X () +withMaybeFocused :: (Maybe Window -> X a) -> X a withMaybeFocused f = withWindowSet $ f . peek normalizeWindows :: X () @@ -118,7 +118,7 @@ markCurrentWindow mark = do markStateMap = Map.insert mark win ms } -pushHistory :: X () -> X () +pushHistory :: X a -> X a pushHistory fn = do withMaybeFocused $ \maybeWindowBefore -> do case maybeWindowBefore of @@ -128,7 +128,7 @@ pushHistory fn = do withWindowSet $ \ws -> XS.modify $ changeHistory (historyPush (TagSpot (currentTag ws))) - fn + ret <- fn withMaybeFocused $ \maybeWindowAfter -> case maybeWindowAfter of @@ -138,6 +138,8 @@ pushHistory fn = do withWindowSet $ \ws -> XS.modify $ changeHistory (historyPush $ TagSpot $ currentTag ws) + return ret + withHistory :: (History Spot -> X ()) -> X () withHistory fn = do MarkState { windowHistory = w } <- XS.get -- cgit