diff options
author | matthewhague <matthewhague@zoho.com> | 2012-07-04 00:27:26 +0200 |
---|---|---|
committer | matthewhague <matthewhague@zoho.com> | 2012-07-04 00:27:26 +0200 |
commit | b9a41641366da55cec06620c9d42f46357d154d3 (patch) | |
tree | 46d3760cb3d698e5ddefbe969abc1cbc79bf79ca | |
parent | 68858069a8b1b0c00867520b40ce5d266cd8293c (diff) | |
download | XMonadContrib-b9a41641366da55cec06620c9d42f46357d154d3.tar.gz XMonadContrib-b9a41641366da55cec06620c9d42f46357d154d3.tar.xz XMonadContrib-b9a41641366da55cec06620c9d42f46357d154d3.zip |
order-unindexed-ws-last
Ignore-this: 4af8162ee8b16a60e8fd62fbc915d3c0
Changes the WorkspaceCompare module's comparison by index to put workspaces without an index last (rather than first).
darcs-hash:20120703222726-d74b8-a673335f340ede40694c1b58899aaaeed4be95d3.gz
-rw-r--r-- | XMonad/Util/WorkspaceCompare.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/XMonad/Util/WorkspaceCompare.hs b/XMonad/Util/WorkspaceCompare.hs index 66e401e..88886f5 100644 --- a/XMonad/Util/WorkspaceCompare.hs +++ b/XMonad/Util/WorkspaceCompare.hs @@ -40,12 +40,20 @@ getWsIndex = do spaces <- asks (workspaces . config) 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 -- tags in the user's config. getWsCompare :: X WorkspaceCompare getWsCompare = do wsIndex <- getWsIndex - return $ mconcat [compare `on` wsIndex, compare] + return $ mconcat [indexCompare `on` wsIndex, compare] -- | A simple comparison function that orders workspaces -- lexicographically by tag. |