xmonad / xmonad-contrib

Contributed modules for xmonad
https://xmonad.org
BSD 3-Clause "New" or "Revised" License
579 stars 272 forks source link

Add loggers for window classname #800

Closed 1in1 closed 1 year ago

1in1 commented 1 year ago

Description

This PR adds loggers to expose the X window classname of the current window. It adds the following, which each have an existing counterpart for logging window titles:

This is motivated by wanting to create statusbar output which provides the classname of the current window. XMonad.Util.NamedWindows provides both:

There are currently methods for fetching the former, but not the latter. The implementation here is identical to the existing code for the window title.

Note: While it looks like there ought to be more opportunity to share code, a lot of the existing methods are exported and have non-generic signatures. I figured it easier to just rewrite.

Note: Firefox comes through as Navigator for me, so a common requirement in a formatter might be a string replace on that word. I'm not adding that here as I feel that's an end-user task.

Checklist

TheMC47 commented 1 year ago

Thank you for your contribution🎉

I'm not sure about adding another PP field at this point. Maybe adding this functionality as a logger instead is better?

1in1 commented 1 year ago

That's reasonable! I'll take a look :)

geekosaur commented 1 year ago

It's not exactly personal preference: appName and className are intended for programmatic use, while title is more user-oriented. That said, I can see it being useful in some cases.

1in1 commented 1 year ago

Squashed and over to you guys when ready :) thanks!

TheMC47 commented 1 year ago

@1in1 congrats on getting your contribution merged! Looking forward to what else you have to add 😀