[xmonad] Workspace ordering and DynamicWorkspaces (+ patch)
Pablo Olmos de Aguilera C.
pablo at glatelier.org
Tue Jan 15 02:52:52 CET 2013
On 14 January 2013 21:50, Hans Chen <hanswchen at gmail.com> wrote:
> As far as I know, it's not in 0.11 (I had to apply the patch manually).
> You'll have to wait for 0.12 or use darcs.
Considering the time took between versions, I rather use darcs. I
thinks it's time to learn.
> The patch is not specific to X.A.DynamicWorkspace (it affects
> X.U.WorkspaceCompare), but you'll notice it when creating a new workspace
Yes, indeed with the darcs version works that way.
> Hope that helps,
A couple of months ago, you started a similar thread, it derived in
a sort-of offtopic discussion, but there were a very interesting part,
that you might find useful.
myDzenPP = defaultPP
, ppSort = getSortByMyRule
-- First show visible screens, then invisible screens with more
-- recently visited ones earlier. I'd also like to see the empty
-- invisible ones, in a different colour.
myWorkspaceCompare :: Bool -> X WorkspaceCompare
myWorkspaceCompare phy = do
w <- gets windowset
return $ \ a b -> case (isOnScreen a w, isOnScreen b w) of
(True, False) -> LT
(False, True) -> GT
(True, True) -> cmpPosition phy w a b
(False, False) -> comparing (recentlySeen w) a b
recentlySeen w t = case findIndex (t==) $ map (W.tag .
W.workspace) (W.visible w) of
Just n -> n
Nothing -> length (W.visible w)
allScreens w = W.current w : W.visible w
isOnScreen a w = a `elem` map (W.tag . W.workspace) (allScreens w)
tagToSid s x = W.screen $ fromJust $ find ((== x) . W.tag . W.workspace) s
cmpPosition False w a b = comparing (tagToSid $ allScreens w) a b
cmpPosition True w a b = comparing (rect.(tagToSid $ allScreens w)) a b
where rect i = let (Rectangle x y _ _) = screens !! fromIntegral
i in (y,x)
screens = map (screenRect . W.screenDetail) $ sortBy
(comparing W.screen) $ W.current w : W.visible w
getSortByMyRule = mkWsSort $ myWorkspaceCompare True
That part was from Jacek Generowitz xmonad.hs, and does basically
what it says in the comment. Sadly, the whole file expired, so I could
post what I found in my ~/.xmonad directory.
Sorry for the OT, but the famous issue with the ICCCM patch it's on
0.11 or darcs? or it hasn't been applied? For future reference, where
I am supposed to look if I have this kind of doubts?
Pablo Olmos de Aguilera Corradini - @PaBLoX
Linux User: #456971 - http://counter.li.org/
More information about the xmonad