Conversation
We already have `ppVisibleNoWindows` and `ppHiddenNoWindows`, this change adds the missing `ppCurrentNoWindows` printer, as well as matching predicates (`isCurrentNoWindows`, `hasWindows`).
|
I will wait to see what Solid has to say, but my initial reaction is that breaking an API going back to 2007 is probably not the greatest of ideas, especially when it'd be silent breakage. |
|
Fair point, we can also change the predicates to make the change non-breaking, at the cost of inconsistency (probably worth it). Adding just the printer should not break anything. If you want to merge it in some form or another, lmk, I can change the PR. Or you can just close it, I don't care either way, I'm just recently switching to XMonad and found this surprisingly difficult to configure for what it is, but I'm fine just changing my own config. |
Yeah, I think I would agree. Perhaps a separate printer would be better |
or just a logger? |
|
or just a logger?
Yes! This is what I was thinking of, since we were talking about
ppExtras anyways. In my head it was clear, I swear! :)
|
42d126c to
f831d7e
Compare
|
Thanks for the input (and the approval that came before I could even write a comment). Here's a better proposal, one that doesn't break the API, only adds new functionality. There's a fallback which should ensure existing configurations still work, but hopefully this will make XMobar a bit easier to configure. If you have any further comments/remarks, let me know, I'm happy to incorporate them. |
TheMC47
left a comment
There was a problem hiding this comment.
I was checking the code again, and I'm not sure of extending the PP type for every predicate (and I'm not sure where we should draw the line).
Did you check the ppPrinters API?You could add your own predicate with your own format, and it will take precedence
Description
We already have
ppVisibleNoWindowsandppHiddenNoWindows, this change adds the missingppCurrentNoWindowsprinter, as well as matching predicates (isCurrentNoWindows,isCurrentHasWindows,hasWindows).isCurrentremains as was and doesn't care about windows. However, the new predicates allow you to check whether a layout is thecurrentone but also contains/doesn't contain windows.ppCurrentNoWindowsfalls back toppCurrentif set toNothing(also the default value), so existing configurations should not break in any way, but can be extended easily.This PR shouldn't break anything as the existing public API remains unchanged, with only slight internal implementation changes and new additions to the API.
It's also not strictly necessary, you could achieve similar results by using
ppPrintersand creating a custom predicate, but that just seems like an inconsistent and complicated way to do it, when we already have the other two printers. The change in code is rather small and could simplify configuration for some users.In the first picture, the workspace has at least one window open.
And here's an example of the current workspace not having any windows open.
Sample configuration, which should allow you to reproduce the example with Xmobar.
Checklist
[*] I've read CONTRIBUTING.md
[*] I've considered how to best test these changes (property, unit,
manually, ...) and concluded: Test manually, swap to a workspace with no windows
[*] I updated the
CHANGES.mdfile