-
-
Notifications
You must be signed in to change notification settings - Fork 724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/Hyprland: Allow matching against Window Titles for Rewrite #2563
Feat/Hyprland: Allow matching against Window Titles for Rewrite #2563
Conversation
this file was edited in Alexays#2558 but not linted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is unrelated to this PR and was simply linted it in f8340d8
Looks like freebsd check failed to build properly. |
Yeah, my last PR #2568 did too. Unfortunately I can't do much to help it; the logs don't mention the reason it failed, it just goes from "Copying files" to "/bin/bash failed". Would need to re-run it with debug logging enable, but I don't have permissions for that. |
This is what I see looking at the checks logs under
|
My bad, I was looking at the wrong step. I'll take a look at it |
Apparently the pipeline runs with Clang 14, which still didn't support direct initialization. Fixed in c59264d. Thanks, @khaneliman ! |
Tested locally seems to work, as intended. @Alexays should be good to go |
Thanks! |
Resolves #2561
About this PR
This PR builds upon #2529 to introduce matching against a window's title in order to get its icon. In order to do that, the function that matches against regexes will now be supplied a string in this format:
"class<WINDOW_CLASS> title<WINDOW_TITLE>"
, as opposed to just the class. This way, users may provide rules in the following forms:Rules are now also prioritized, from more specilized to least. In the previous example, the priority order would be:
Backwards Compatibility
Because of the possible problem pointed out in 4., matching against titles is disabled unless at least one rule explicitly matches against titles. If no rules do so, titles are not sent to the aforementioned function, and, instead, the string
"class<WINDOW_CLASS>"
is used.This does mean, however, that rules written as
"^something_here$"
will not work anymore, and should be replace by either"somethind_here"
,"class<something_here>"
or"^class<something_here>$"
. While I don't believe anyone might've written such a specific rule, I'm open to hear the reasoning for that and work out something that doesn't break this niche use case.Implementation Details
A refactor has been made to separate the logic behind the regex map, its cache and default values. This whole logic is now available as the
waybar::util::RegexCollection
class, which can be constructed from aJson::Value
. This class also provides a way to sort rules, giving priority to whichever rule scores higher in the parameter function.When titles are used in any rules, the workspace module will be subscribed to an additional event called
windowtitle
, which, according to Hyprland's IPC documentation, only features the window's address as a parameter. This means that an additional call to Hyprland's"clients"
socket1 must be made in order to retrieve the window's latest name.The module is not subscribed to this event when titles aren't explicitly used simply because it would be of no use and could break compatibility as mentioned above.