Closed 1in1 closed 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?
That's reasonable! I'll take a look :)
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.
Squashed and over to you guys when ready :) thanks!
@1in1 congrats on getting your contribution merged! Looking forward to what else you have to add 😀
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:
logClassname
logClassnames
logClassnames'
logClassnameOnScreen
logClassnamesOnScreen
logClassnamesOnScreen'
ClassnamesFormat(..)
This is motivated by wanting to create statusbar output which provides the classname of the current window.
XMonad.Util.NamedWindows
provides both:getName
, which provides the title of a window (e.g., "Home - BBC News"), andgetNameWMClass
, which provides the classname of the window (e.g., "chromium").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
[x] I've read CONTRIBUTING.md
[x] I've considered how to best test these changes (property, unit, manually, ...) and concluded: Sufficiently small change that manual testing seems to be appropriate, looking at the existing tests. I've manually tested all of the above loggers separately.
[x] I updated the
CHANGES.md
file