Skip to content
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

Enable using capture groups in window-rewrite #3331

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

Eisfunke
Copy link
Contributor

@Eisfunke Eisfunke commented Jun 5, 2024

This uses std::match_results::format to format the output of get in RegexCollection using the match results.

The effect of this is that you can now use capture groups in the regexes in window-rewrite in the sway and hyprland workspaces modules, similarly to the window module, e.g. like this:

"window-rewrite": {
    "title<.* - (.*) - VSCodium>": "codium $1"  // captures part of the window title and formats it into output
}

This example would rewrite a window titled foo.cpp - Waybar - VSCodium to codium Waybar. This is quite useful to rewrite long window titles, but keeping relevant parts of the original title, in this example the workpsace of the VSCodium window.

I have only tested this with sway. Note that I don't know C++ very well so I hope I haven't accidentally introduced a memory leak or something like that.

@Alexays Alexays merged commit 562e1e5 into Alexays:master Jun 12, 2024
3 of 9 checks passed
@Alexays
Copy link
Owner

Alexays commented Jun 12, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants