xmonad-contrib icon indicating copy to clipboard operation
xmonad-contrib copied to clipboard

ManageHooks don't work well for applications that set their WM Class late in their startup process

Open colonelpanic8 opened this issue 4 years ago • 8 comments

Spotify is a classic example of this. It's pretty much impossible to control spotify's behavior using a manage hook because it doesn't set NET_WM_CLASS to its final value at startup.

Does anyone have a good solution to this problem?

It seems like one solution would be to listen on changes to this property, and reapply the manage hook whenever it matches again. Thoughts?

colonelpanic8 avatar Aug 11 '21 22:08 colonelpanic8

https://github.com/xmonad/xmonad-contrib/blob/master/XMonad/Hooks/DynamicProperty.hs and Spotify is indeed the example of its use. That said, such applications are violating ICCWM and EWMH so I don't see much point in catering to them specifically.

geekosaur avatar Aug 11 '21 22:08 geekosaur

That said, such applications are violating ICCWM and EWMH so I don't see much point in catering to them specifically.

That seems like a silly attitude.. I mean there's no easy way around using some of these applications

colonelpanic8 avatar Aug 11 '21 22:08 colonelpanic8

And that's why X.H.DynamicProperty exists. I do also think that trying too much to compensate for programs blatantly breaking standards will only lead to a lot of headaches

slotThe avatar Aug 12 '21 05:08 slotThe

And that's why X.H.DynamicProperty exists. I do also think that trying too much to compensate for programs blatantly breaking standards will only lead to a lot of headaches

Right, well dynamic property works for my purposes, so its fine with me to close this.

I don't really think we are disagreeing at all here, since everyone seems to be in accordance that its okay for DynamicProperty to exist.

colonelpanic8 avatar Aug 12 '21 06:08 colonelpanic8

@slotThe @geekosaur I guess the one thing I will say is that DynamicProperty is not really the most discoverable name.

Even now that I know what it does, the name itself is actually still kind of impenetrable to me. Nothing about the name relates it to the management of windows, and really, the name seems more fixated on the perceived shortcoming than what it is actually doing.

Something like PropertyChangeHook or OnEventManageHook, or ManageHookToEventHook would be a lot more discoverable, IMO.

colonelpanic8 avatar Aug 12 '21 06:08 colonelpanic8

likewise, to me dynamicPropertyChange is a completely impenetrable name. onXPropertyChange would be a much clearer name, IMO.

colonelpanic8 avatar Aug 12 '21 06:08 colonelpanic8

Might be a good idea to link to this module from https://xmonad.github.io/xmonad-docs/xmonad/XMonad-ManageHook.html and https://xmonad.github.io/xmonad-docs/xmonad-contrib/XMonad-Hooks-ManageHelpers.html, although not sure if it's a good idea to actually make such a link from xmonad to xmonad-contrib and what URL to use.

Oh and if anyone comes up with better names, absolutely do feel free to submit a PR that renames all this stuff as long as a compat module with compat exports all marked deprecated is retained for a couple releases.

liskin avatar Aug 12 '21 11:08 liskin

I'm going to reopen this in the interest of "let's not forget to properly document this at some point". For what it's worth, I like onXPropertyChange as a name!

slotThe avatar Jan 05 '22 06:01 slotThe