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

David Roundy droundy at darcs.net
Wed Oct 3 09:11:37 EDT 2007


On Wed, Oct 03, 2007 at 11:04:19AM +0200, Andrea Rossato wrote:
> Hi,
> 
> this incorporates both my job and Jamie's patch to turn off navigation
> colors.
> 
> To be applied only with David (and Jamie) approval.

Approved.  But I've a few ideas for improvements (see below).

> Wed Oct  3 11:00:17 CEST 2007  Andrea Rossato <andrea.rossato at unibz.it>
>   * WindowNavigation: add configurable colors and the possibility to turn them off

> +data WNConfig = 
> +    WNC { showNavigable :: Bool
> +        , upColor       :: String
> +        , downColor     :: String
> +        , leftColor     :: String
> +        , rightColor    :: String
> +        } deriving (Show, Read)
> +
> +defaultWNConfig :: WNConfig
> +defaultWNConfig = WNC True "#0000FF" "#00FFFF" "#FF0000" "#FF00FF"

I definitely vote for a more muted default.  I set this gaudy color
arrangement only for the purpose of debugging a situation where a wrong
window was getting colored.  I think the original suggester's idea of a
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
        , upColor       :: String
        , downColor     :: String
        , leftColor     :: String
        , rightColor    :: String
        } deriving (Show, Read)

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 was also thinking that a couple of exported WNConfigs would be handy:

noNavigateBorders :: WNConfig
navigateColor :: String -> WNConfig

etc.  So that in common cases, user won't have to fool with fields of the
structure.

I also wouldn't mind (unless we've got a user interested in the multi-color
option) going with a single configurable border color.

In fact, I think it'd be ideal to avoid exporting the WNConfig constructor
at all.  But for now, I'd just go with your patch.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Xmonad mailing list