mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-02 13:11:52 -07:00
order-unindexed-ws-last
Changes the WorkspaceCompare module's comparison by index to put workspaces without an index last (rather than first).
This commit is contained in:
@@ -40,12 +40,20 @@ getWsIndex = do
|
|||||||
spaces <- asks (workspaces . config)
|
spaces <- asks (workspaces . config)
|
||||||
return $ flip elemIndex spaces
|
return $ flip elemIndex spaces
|
||||||
|
|
||||||
|
-- | Compare Maybe's differently, so Nothing (i.e. workspaces without indexes)
|
||||||
|
-- come last in the order
|
||||||
|
indexCompare :: Maybe Int -> Maybe Int -> Ordering
|
||||||
|
indexCompare Nothing Nothing = EQ
|
||||||
|
indexCompare Nothing (Just _) = GT
|
||||||
|
indexCompare (Just _) Nothing = LT
|
||||||
|
indexCompare a b = compare a b
|
||||||
|
|
||||||
-- | A comparison function for WorkspaceId, based on the index of the
|
-- | A comparison function for WorkspaceId, based on the index of the
|
||||||
-- tags in the user's config.
|
-- tags in the user's config.
|
||||||
getWsCompare :: X WorkspaceCompare
|
getWsCompare :: X WorkspaceCompare
|
||||||
getWsCompare = do
|
getWsCompare = do
|
||||||
wsIndex <- getWsIndex
|
wsIndex <- getWsIndex
|
||||||
return $ mconcat [compare `on` wsIndex, compare]
|
return $ mconcat [indexCompare `on` wsIndex, compare]
|
||||||
|
|
||||||
-- | A simple comparison function that orders workspaces
|
-- | A simple comparison function that orders workspaces
|
||||||
-- lexicographically by tag.
|
-- lexicographically by tag.
|
||||||
|
Reference in New Issue
Block a user