[Xmonad] darcs patch: WindowNavigation: add configurable colors and the poss...

David Roundy droundy at darcs.net
Wed Oct 3 14:55:56 EDT 2007


On Wed, Oct 03, 2007 at 07:14:43PM +0200, Andrea Rossato wrote:
> On Wed, Oct 03, 2007 at 06:11:37AM -0700, David Roundy wrote:
> > muted red would be reasonable.  Even better would be an automatic weighted
> > average of borderNormal and borderFocussed (as the default).  This would
> > require something like:
> > 
> > data WNConfig = 
> >     WNC { showNavigable :: Bool
> >         , averageFocusAndNormal :: Double
> [...]
> > 
> > Note that this average idea could be tricky.  If both colors are of the
> > form "#00ff00", then it's easy, we convert to three Ints and back.
> > Otherwise, I think we'd have to involve X to compute the color values, and
> > I'm not sure how to do that.
> 
> I don't thin I've already understood this weighted average stuff but
> it sounds cool and I'll try to implement it. Actually I'm going to put
> it on my TODO list... the best I can do right now.

My idea is that if we can write functions like

redComponent   :: Color -> Double -- ranges from zero to one
greenComponent :: Color -> Double -- ranges from zero to one
blueComponent  :: Color -> Double -- ranges from zero to one
newColor :: Double -> Double -> Double -> X Color -- rgb

then we could do something like:

do fc <- asks focusedBorder
   nc <- asks normalBorder
   let f = max 1 $ min 0 $ frac
       n = 1 - f
       combine comp = f*(comp fc) + n*(comp nc)
   defaultBorder <- newColor (combine redComponent)
                             (combine greenComponent)
                             (combine blueComponent)

But I'm not sure how to extract the components of a color.  Constructing a
new color with given components seems relatively easy, just by printing the
values out as a hex string.

> > I was also thinking that a couple of exported WNConfigs would be handy:
> 
> The rest of you requests seem very useful to me to and I'm going to
> send a patch soon.

That'd be great!
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Xmonad mailing list