[Xmonad] [re previous] darcs patch: Proposal for themeable tabs (read desc before applying)

David Roundy droundy at darcs.net
Wed Jun 13 12:26:57 EDT 2007


On Wed, Jun 13, 2007 at 05:18:05PM +0200, Andrea Rossato wrote:
> hunk ./Tabbed.hs 31
> +import {-# SOURCE #-} Config (TabTheme(..), tabTheme)

I think we're much better off avoiding recursive imports... I wish xmonad
itself would do this.  Recursive imports restrict the user choice and add
code complexity at the same time.  A much better approach would be have no
recursive imports, but instead export the type TabTheme (and a
defaultTheme) and the function

tabbed :: TabTheme -> Layour

and then the user can have tabbed layouts with multible different themes in
their defaultLayouts, they can create keybindings to modify the theme at
runtime.  Probably most users will never do any of these things (and maybe
they shouldn't), but with the Combo layout (and I have some ideas how to
fix it to work with tabbed once more) it might be reasonable to set
different colors for different sub-tabbed layouts.  Or a user might want
instant visual recognition of which workspace they're in by changing the
tab colors.  Or they might want to dynamically reduce the tab size when
they can't quite see enough of the pdf file they're reading.

Anyhow, it simplifies the code and makes it more powerful.  A win-win
situation.

> hunk ./Tabbed.hs 35
> --- You can use this module with the following in your configuration file:
> +-- You can use this module with the following in your Config.hs file:
> hunk ./Tabbed.hs 42
> +--
> +-- > data TabTheme a = Integral a => 
> +-- >     TabTheme { bgColor :: Pixel
> +-- >              , fgColor :: Pixel
> +-- >              , focusColor :: Pixel
> +-- >              , unfocusColor :: Pixel
> +-- >              , textColor :: Pixel
> +-- >              , tabSize :: a
> +-- >              }

I'd just make the tabSize an Int.  It simplifies things, at the cost
perhaps of a couple of fromIntegrals in the code.

It'd be nice to also have some font-configuration possibilities, but the
last time I tried to mess with fonts I crashed xmonad.  It should no longer
crash, with the catchX patches in.  The possibility of larger font is
definitely a big user-interface win for folks with not-so-good eyesight.

Another possibility would be something like

data TabTheme = TabTheme { unfocussedConfigureGC :: Display -> Window -> GC -> X ()
                         , focussedConfigureGC :: Display -> Window -> GC -> X ()
                         , tabSize :: Int }

This isn't quite so friendly to users, but is more powerful.  With
appropriate helper functions, non-haskell folks shouldn't have *too* much
trouble doing this configurization.  You'd *definitely* want to run these
functions within a catchX, though.

Another feature to add (which relates) is that we might want a third color,
which is visibleButNotFocussedColor, which would be when the decorated
window is the focussed window in the workspace, but doesn't actually have
the keyboard focus (which is on another workspace, or a float window).
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Xmonad mailing list