
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

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).

Many thanks! Works perfectly. I saw asks and liftX mentioned in other
ManageHooks but will need to read up on monads among other things to
understand them.
Mike
On Wed, Mar 18, 2009 at 10:08 PM, Daniel Schoepe
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). _______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
participants (2)
-
Daniel Schoepe
-
Mike Sampson