[xmonad] ppVisible with 3 screens
Norbert Zeh
nzeh at cs.dal.ca
Thu Oct 7 20:31:44 EDT 2010
Felix Blanke [2010.10.04 0114 +0200]:
> The getXineramaWsCompare maybe?! :)
>
> getXineramaWsCompare :: X WorkspaceCompare
> getXineramaWsCompare = do
> w <- gets windowset
> return $ \ a b -> case (isOnScreen a w, isOnScreen b w) of
> (True, True) -> comparing (tagToSid (onScreen w)) a b
> (False, False) -> compare a b
> (True, False) -> LT
> (False, True) -> GT
> where
> onScreen w = S.current w : S.visible w
> isOnScreen a w = a `elem` map (S.tag . S.workspace) (onScreen w)
> tagToSid s x = S.screen $ fromJust $ find ((== x) . S.tag . S.workspace) s
>
>
> The getSortByXineramaRule use that function:
>
> getSortByXineramaRule :: X WorkspaceSort
> getSortByXineramaRule = mkWsSort getXineramaWsCompare
>
>
> But like I said: I'm a haskell noob. When I understand those functions right the
> getXineramaWsCompare creates a ranking where the visible workspaces get the
> smallest id and mkWsSort then sorts that output.
>
> I have to thing about that how to change that ranking to get them in the right order.
Alright, Felix, as promised here comes the way to do this. I'm not sure
about your setup. So you may have to tweak it a little. I assume here
that your left screen is #2, middle is #1, right is #3.
The easiest way to get what you want (in addition to what I said in the
previous email) is the following:
1) Hook your custom sorting function into the log hook
ppSort = myXineramaSorter
2) Actually write your custom sorting function
myXineramaSorter = do
srt <- getSortByXineramaRule
let prm (one:two:three:rest) = two:one:three:rest
return (prm . srt)
All this does is permute the first three workspaces (which the standard
xinerama sorter guarantees are the visible ones) in the order (2,1,3).
In this example, since we're only swapping the first two screens, you
could actually simplify this to
let prm (one:two:rest) = two:one:rest
(Note: I'm typing this from a windows box :( and, thus, haven't tested
this. Let me know if it doesn't work.)
Now this does not do the colour coding you wanted, but that may actually
no longer be necessary if you just see your three screens in the right
order.
Cheers,
Norbert
More information about the xmonad
mailing list