Move EWMH support initialization to a startupHook

This patch will break existing configs. EwhmDesktops.setSupported sets some X atoms to constants. This should rightfully be done once, in a startup hook, rather than repeatedly in the log hook. This complicates the user configs a bit (though they can just use Config.Desktop) but fixes problems like setWMName having to be called in the log hook if ewmh is being used.

Excerpts from Justin Bogner's message of Sat Oct 10 23:44:51 -0600 2009:
This patch will break existing configs.
EwhmDesktops.setSupported sets some X atoms to constants. This should rightfully be done once, in a startup hook, rather than repeatedly in the log hook. This complicates the user configs a bit (though they can just use Config.Desktop) but fixes problems like setWMName having to be called in the log hook if ewmh is being used.
This would be great to have in 0.9 if it can be evaluated in time. It's a much better way to handle the constants. It's also good to spread out config breakers across releases, and we don't have many for 0.9 as it stands currently; this would be a good time for such a change. I'm going to test it out with gnome-panel, trayer, and perhaps some other desktops over the next few days, but wanted to give you a heads up, Justin, that it would be good to send a new patch reconciling with recent change to Config.Desktop. The recent mouse cursor patches modified the desktopConfig startupHook creating a conflict. I don't think it should conflict with the C.Desktop documentation patch I just sent, but haven't tested that yet. Here's how I resolved it: - { logHook = ewmhDesktopsLogHook - , layoutHook = desktopLayoutModifiers $ layoutHook defaultConfig - , manageHook = manageHook defaultConfig <+> manageDocks + { startupHook = setDefaultCursor xC_left_ptr >> ewmhDesktopsStartup + , logHook = ewmhDesktopsLogHook + , layoutHook = desktopLayoutModifiers $ layoutHook defaultConfig + , manageHook = manageHook defaultConfig <+> manageDocks It also sets a few new atoms as supported, so as much as I hate to say it and prolong the hideous logHook = setWMName "xmonad" >> setWMName "LG3D" nonsense, it is tempting to postpone this change to give more time in darcs for settling. regards, -- wmw

Excerpts from Justin Bogner's message of Sat Oct 10 23:44:51 -0600 2009:
This patch will break existing configs.
EwhmDesktops.setSupported sets some X atoms to constants. This should rightfully be done once, in a startup hook, rather than repeatedly in the log hook.
Another point in favor of applying the change pre-0.9 is that non-darcs users that explicitly use EwmhDesktops rather than one of the desktop configs already must change layoutHook and add handleEventHook when upgrading to 0.9. Modifying startupHook at the same time is not much more to ask. -- wmw

On Sat, Oct 10, 2009 at 11:44:51PM -0600, Justin Bogner wrote:
This patch will break existing configs.
EwhmDesktops.setSupported sets some X atoms to constants. This should rightfully be done once, in a startup hook, rather than repeatedly in the log hook. This complicates the user configs a bit (though they can just use Config.Desktop) but fixes problems like setWMName having to be called in the log hook if ewmh is being used.
Sat Oct 10 23:35:38 MDT 2009 Justin Bogner
* Move EWMH support initialization to a startupHook Set EWMH support atoms and the window manager name in a startup hook, rather than in the log hook: the log hook occurs far too frequently for it to make sense to set constants with it.
I think that the benefits of this patch outweigh the breakage since the current behavior is somewhat broken in my opinion. Applied, thanks!

* On Thursday, October 22 2009, Daniel Schoepe wrote: [...]
I think that the benefits of this patch outweigh the breakage since the current behavior is somewhat broken in my opinion.
Applied, thanks!
I would like to avoid config breakage, even if it is only for darcs-users (since the ewmhdesktops changed from a layout to event hook from 0.8). We can accomplish the same thing by making a top-level, non-exported IORef Bool (as is already done in other modules such as UrgencyHook), and then checking that one if we need to set the X atoms. Once Daniel's extensible state patch gets applied in core, it will be simple to replace the IORef with the use of that feature. Attached is a patch that makes these changes. I think it should be applied before the 0.9 freeze, but I'm not going to do that because there were some objections in #xmonad such as: - IORefs are evil - it only applies to darcs version users, and these are supposed to handle these things -- Adam

On Thu, Oct 22, 2009 at 08:06:21PM -0400, Adam Vogt wrote:
* On Thursday, October 22 2009, Daniel Schoepe wrote: [...]
I think that the benefits of this patch outweigh the breakage since the current behavior is somewhat broken in my opinion.
Applied, thanks!
I would like to avoid config breakage, even if it is only for darcs-users (since the ewmhdesktops changed from a layout to event hook from 0.8).
We can accomplish the same thing by making a top-level, non-exported IORef Bool (as is already done in other modules such as UrgencyHook), and then checking that one if we need to set the X atoms.
Once Daniel's extensible state patch gets applied in core, it will be simple to replace the IORef with the use of that feature.
Attached is a patch that makes these changes. I think it should be applied before the 0.9 freeze, but I'm not going to do that because there were some objections in #xmonad such as:
- IORefs are evil - it only applies to darcs version users, and these are supposed to handle these things
-- Adam
Top level IORefs are evil, but sometimes they're the path of least resistance. The arguments against top level state have been repeated many times, so let's put that aside for now. I think that the current state of EWMH is how things ought to be, a clear separation between initialization steps and steps that are repeated on each layout. Cheers, Spencer Janssen
participants (5)
-
Adam Vogt
-
Daniel Schoepe
-
Justin Bogner
-
Spencer Janssen
-
Wirt Wolff