[xmonad] Help with ManageHook

Daniel Schoepe asgaroth_ at gmx.de
Wed Mar 18 07:08:51 EDT 2009

Mike Sampson wrote:
> Hi,
> I'm trying to write my own ManageHook however as I am still trying to
> learn Haskell and don't have a 100% clear view of the internals of
> XMonad I'm having some trouble.
> My goal is to set the transparency of certain windows, matched via class
> name, as they are created. FadeInactive.hs has a setOpacity function
> which does this no problem. FadeInactive is driven from a LogHook
> whereas I want to drive it from a ManageHook. What is the *magic glue*
> needed to do something like:
> [ className =? "URxvt" --> setOpacity window 0x99999999]
> in my manage hooks. I know that setOpacity is not a ManageHook and that
> i need to wrap it in something however looking at other ManageHooks,
> such as doFloat, has not made things clear to me. Can anyone help with
> this or provide a better way of doing it?
> Regards,
> Mike

If you want to get the window in question, you need to use `ask':

.. --> (ask >>= \w -> liftX (setOpacity w 0x99999999) >> idHook)

One also needs liftX to lift a normal X action into a Query(The type
expected by the `-->' operator). idHook ensures the proper return
type(ManageHooks have to return transformations of the window set, but
since we don't want to change the window set itself, we use idHook).

More information about the xmonad mailing list