diff options
| author | Josh Rahm <rahm@google.com> | 2023-12-08 16:13:52 -0700 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2023-12-08 16:13:52 -0700 |
| commit | 718d69736e5dfd946648e7a305c15281d9656466 (patch) | |
| tree | 0aa849edd4736d6b0c9bd1865a9ea09dd935ebd8 /src/Rahm/Desktop/History.hs | |
| parent | 87b103a4995fd2b6bbd1e72c446fd789caf5a050 (diff) | |
| download | rde-718d69736e5dfd946648e7a305c15281d9656466.tar.gz rde-718d69736e5dfd946648e7a305c15281d9656466.tar.bz2 rde-718d69736e5dfd946648e7a305c15281d9656466.zip | |
Revert "Experimental ability to pin a window using Mod+p"
This reverts commit 87b103a4995fd2b6bbd1e72c446fd789caf5a050.
Diffstat (limited to 'src/Rahm/Desktop/History.hs')
| -rw-r--r-- | src/Rahm/Desktop/History.hs | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/src/Rahm/Desktop/History.hs b/src/Rahm/Desktop/History.hs index d1a4bb9..ffcb10e 100644 --- a/src/Rahm/Desktop/History.hs +++ b/src/Rahm/Desktop/History.hs @@ -58,7 +58,7 @@ zipperDbgPrint _ = "<empty>" pushZipper :: a -> BoundedSeqZipper a -> BoundedSeqZipper a pushZipper e (BoundedSeqZipper maxSize _ (tail :|> _)) | maxSize <= Seq.length tail = - BoundedSeqZipper maxSize mempty (e :<| tail) + BoundedSeqZipper maxSize mempty (e :<| tail) pushZipper e (BoundedSeqZipper maxSize _ tail) = BoundedSeqZipper maxSize mempty (e :<| tail) @@ -133,44 +133,44 @@ data ScreenDiff = ScreenDiff newLocation :: Location } -historyHook :: StackChangeHook +historyHook :: WindowStack -> WindowStack -> X () -- History hook where the 'from' location workspace does not match the 'to' -- location workspace. -historyHook = StackChangeHook $ \lastWindowSet currentWindowSet -> do +historyHook lastWindowSet currentWindowSet = do (History hist) <- XS.get forM_ (getScreenDiffs lastWindowSet currentWindowSet) $ -- Read as "the screen <sid> went from <oloc> to <nloc>" \(ScreenDiff sid oloc nloc) -> let (ows, nws) = (locationWorkspace oloc, locationWorkspace nloc) - in -- The goal here is to preserve history in as intuitive a way as possible - -- When the stackset changes, for each screen that changed in the last - -- windowchange, one of 2 situations are possibel: - -- - -- 1. The workspace on the screen was swapped with an already visible - -- screen - -- - -- 2. The workspace on the screen was swapped with a hidden workspace. - -- - -- In the case of 1, we want to treat it as if the screen was - -- "reseated" to a different monitor, preserving the history for that - -- screen on its new screen. - -- - -- In case of 2, we want to add the old workspace to the history of the - -- screen that changed. - case () of - () - | nws `visibleIn` lastWindowSet, - (Just oscr) <- screenOf nws lastWindowSet -> - -- The last workspace was on a different screen. Swap the current - -- screen's history with the history from the last screen the - -- workspace was on. - XS.modify $ \(History byScreen) -> - History - ( Map.alter - (const $ Map.lookup oscr hist) - sid - byScreen - ) + + -- The goal here is to preserve history in as intuitive a way as possible + -- When the stackset changes, for each screen that changed in the last + -- windowchange, one of 2 situations are possibel: + -- + -- 1. The workspace on the screen was swapped with an already visible + -- screen + -- + -- 2. The workspace on the screen was swapped with a hidden workspace. + -- + -- In the case of 1, we want to treat it as if the screen was + -- "reseated" to a different monitor, preserving the history for that + -- screen on its new screen. + -- + -- In case of 2, we want to add the old workspace to the history of the + -- screen that changed. + in case () of + () | nws `visibleIn` lastWindowSet, + (Just oscr) <- screenOf nws lastWindowSet -> + -- The last workspace was on a different screen. Swap the current + -- screen's history with the history from the last screen the + -- workspace was on. + XS.modify $ \(History byScreen) -> + History + ( Map.alter + (const $ Map.lookup oscr hist) + sid + byScreen + ) -- The new workspace was not originally visible, add to history () | not (nws `visibleIn` lastWindowSet) -> XS.modify $ \(History byScreen) -> @@ -180,6 +180,7 @@ historyHook = StackChangeHook $ \lastWindowSet currentWindowSet -> do sid byScreen ) + -- This is typically not a possible case. It's only possible when a -- screen is unplugged. If that's the case, do nothing. _ -> return () |