[xmonad] ppVisible with 3 screens
Felix Blanke
felixblanke at gmail.com
Fri Oct 8 05:52:56 EDT 2010
Hello,
thanks a lot for your work!
It works :) The short version
"let prm (one:two:rest) = two:one:rest"
is enough, because I only need to switch the first two elements.
With this hack I don't need the colour thing.
Thanks again!
Regards,
Felix
On 07. October 2010 - 21:31, Norbert Zeh wrote:
> Date: Thu, 7 Oct 2010 21:31:44 -0300
> From: Norbert Zeh <nzeh at cs.dal.ca>
> To: XMonad Mailing List <xmonad at haskell.org>
> Subject: Re: [xmonad] ppVisible with 3 screens
>
> 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
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad
---end quoted text---
More information about the xmonad
mailing list