mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.H.WorkspaceHistory: Fix hlint nits, strictness
There is no reason why the used maps should not be strict, as we are definitely traversing.
This commit is contained in:
parent
62e9941d3d
commit
280c1a8ed5
@ -60,7 +60,7 @@ where
|
|||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
|
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map.Strict as M
|
||||||
import qualified XMonad.Hooks.DynamicLog as DL
|
import qualified XMonad.Hooks.DynamicLog as DL
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import Prelude
|
|||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import XMonad.StackSet hiding (delete, filter, new)
|
import XMonad.StackSet hiding (delete, filter, new)
|
||||||
import Data.List (delete, find, groupBy, nub, sortBy)
|
import Data.List (delete, find, foldl', groupBy, nub, sortBy)
|
||||||
import qualified XMonad.Util.ExtensibleState as XS
|
import qualified XMonad.Util.ExtensibleState as XS
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
@ -61,7 +61,7 @@ import qualified XMonad.Util.ExtensibleState as XS
|
|||||||
--
|
--
|
||||||
-- To make use of the collected data, a query function is provided.
|
-- To make use of the collected data, a query function is provided.
|
||||||
|
|
||||||
data WorkspaceHistory = WorkspaceHistory
|
newtype WorkspaceHistory = WorkspaceHistory
|
||||||
{ history :: [(ScreenId, WorkspaceId)] -- ^ Workspace Screens in
|
{ history :: [(ScreenId, WorkspaceId)] -- ^ Workspace Screens in
|
||||||
-- reverse-chronological order.
|
-- reverse-chronological order.
|
||||||
} deriving (Typeable, Read, Show)
|
} deriving (Typeable, Read, Show)
|
||||||
@ -101,7 +101,7 @@ workspaceHistoryTransaction :: X () -> X ()
|
|||||||
workspaceHistoryTransaction action = do
|
workspaceHistoryTransaction action = do
|
||||||
startingHistory <- XS.gets history
|
startingHistory <- XS.gets history
|
||||||
action
|
action
|
||||||
new <- (flip updateLastActiveOnEachScreen $ WorkspaceHistory startingHistory) <$> gets windowset
|
new <- flip updateLastActiveOnEachScreen (WorkspaceHistory startingHistory) <$> gets windowset
|
||||||
XS.put new
|
XS.put new
|
||||||
|
|
||||||
-- | Update the last visible workspace on each monitor if needed
|
-- | Update the last visible workspace on each monitor if needed
|
||||||
@ -113,7 +113,7 @@ updateLastActiveOnEachScreen = updateLastActiveOnEachScreenExclude []
|
|||||||
-- exclude certain workspaces.
|
-- exclude certain workspaces.
|
||||||
updateLastActiveOnEachScreenExclude :: [WorkspaceId] -> WindowSet -> WorkspaceHistory -> WorkspaceHistory
|
updateLastActiveOnEachScreenExclude :: [WorkspaceId] -> WindowSet -> WorkspaceHistory -> WorkspaceHistory
|
||||||
updateLastActiveOnEachScreenExclude ws StackSet {current = cur, visible = vis} wh =
|
updateLastActiveOnEachScreenExclude ws StackSet {current = cur, visible = vis} wh =
|
||||||
WorkspaceHistory { history = doUpdate cur $ foldl updateLastForScreen (history wh) $ vis ++ [cur] }
|
WorkspaceHistory { history = doUpdate cur $ foldl' updateLastForScreen (history wh) $ vis ++ [cur] }
|
||||||
where
|
where
|
||||||
firstOnScreen sid = find ((== sid) . fst)
|
firstOnScreen sid = find ((== sid) . fst)
|
||||||
doUpdate Screen {workspace = Workspace { tag = wid }, screen = sid} curr =
|
doUpdate Screen {workspace = Workspace { tag = wid }, screen = sid} curr =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user