[xmonad] ppVisible with 3 screens

Norbert Zeh nzeh at cs.dal.ca
Sun Oct 3 16:31:29 EDT 2010


Felix Blanke [2010.10.03 1618 +0200]:
> Hi,
> 
> thanks for that hint :)
> 
> That does help, but for me it would be mutch nicer to have that thing with the
> different colors working.
> 
> It is kind of confusing with that sorting thing:
> My primary monitor is the one in the middle. With that sorting thing the workspace
> visible at the middle monitor comes first, then the left one and then the right one.
> 
> Would it be possible to change that? Like: Workspace on the left one is listed first,
> workspace on the middle one (primary) listed second and workspace on the right one
> listed third?
> It would be also nice to have a seperator after the first 3 workspaces :)

I have a setup like that working.  I have two screens, and my status bar
tells me what's on each screen, including their layouts, followed by a
list of *all* workspaces, colour-coded according to whether or not they
contain windows.  So the end of my statusbar looks something like this:

1:Shell (Left) 3:Edit (Top) | 1234567890

with appropriate colours assigned to the 1234567890 sequence.

The downside is that the only way I could see to achieve this is to
collect this information myself from the stackset using hooks added to
ppExtra.  What you're trying to do can be done the same way.  If you're
willing to go to such lengths, I can elaborate.

Come to think of it, what you are trying to do, including separator, can
be done using just the right sorter, formatting function and a bit of
postprocessing as follows:

As sorter, you want to use X.U.WorkspaceCompare.getSortByXineramaRule.
This places your visible workspaces first, sorted by screen.  If that
doesn't do what you want because the screens are not numbered left to
right, you should look at the code of getSortByXineramaRule and tweak it
to sort the visible workspaces the way you want.  It's not hard.

As formatting rule, you want (probably you want to add appropriate
colouring):

ppVisible = (++ "|")
ppCurrent = (++ "|")
ppHidden  = id

Finally, you want

ppOrder = (\(ws:l:t:_) -> [postprocess ws, l, t])

with

postprocess = delete '|' . delete '|'
(For four screens, you would use three "delete '|'" here.)

To get the "delete" function, you need to import Data.List.

Cheers,
Norbert

> 
> Regards,
> Felix
> 
> 
> On 03. October 2010 - 14:44, Juraj Hercek wrote:
> > Date: Sun, 03 Oct 2010 14:44:06 +0200
> > From: Juraj Hercek <juhe_xmonad at hck.sk>
> > To: Felix Blanke <felixblanke at gmail.com>
> > CC: xmonad at haskell.org
> > Subject: Re: [xmonad] ppVisible with 3 screens
> > 
> > Hi Felix,
> > 
> > On 09/30/2010 01:29 PM, Felix Blanke wrote:
> > > ...
> > > I was using 2 screens with xmonad and xmobar.
> > >
> > > The settings
> > >
> > > ppCurrent = xmobarColor "#CC0000" "" . wrap "[" "]"
> > > , ppVisible = xmobarColor "#EE9A00" "" . wrap "[" "]"
> > > , ppTitle =  shorten 80
> > > , ppSep =  "<fc=#AFAF87>  |</fc>"
> > > , ppHiddenNoWindows = xmobarColor "#AFAF87" ""
> > > , ppUrgent = xmobarColor "#EE9A00" "" . wrap "[" "]"
> > >
> > > worked good for 2 screens: The active workspace is red and the inactive is orange.
> > >
> > > But now, with 3 screens, there are 2 inactive workspaces and they both are orange. Is
> > > there a way to say:
> > >
> > > inactive on screen 0 = blue
> > > inactive on screen 1 = ornage
> > > inactive on screen 3 = green
> > >
> > > or something similar.
> >  > ...
> > 
> > I'm not sure if the thing you want to achieve is (easily) possible with 
> > current implementation. But maybe you want to use better sorting 
> > algorithm, more suitable for configurations with more than 2 workspaces. 
> > This is how my PP looks like (the ppSort line is most interesting to you):
> > 
> > ---8<---
> > myPP :: PP
> > myPP = defaultPP { ppOutput  = putStrLn
> >                   , ppCurrent = color "yellow" ""
> >                   , ppVisible = color "lightblue ""
> >                   , ppUrgent  = color "red" ""
> >                   , ppSort    = getSortByXineramaRule
> >                   } where color = xmobarColor
> > --->8---
> > 
> > Cheers,
> > Juraj
> ---end quoted text---
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad
> 


-- 

()  ascii ribbon campaign  -  against html e-mail
/\  www.asciiribbon.org    -  against proprietary attachments


More information about the xmonad mailing list