swallow: Add swallow_exception_regex #2026
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your PR, what does it fix/add?
Currently, if a window class is specified in the swallow_regex (e.g. Kitty) it will swallow every other window spawned by it automatically. Many other WMs implementing this functionality allow for defining exceptions from this rule. For instance, we want Kitty to swallow sxiv or zathura but we do not want Kitty to swallow something like wev.
This commit adds an additional regex - swallow_exception_regex where these exceptions can be defined. This regex is then compared against the title of the window about to be swallowed and if it happens to be a match, aborts the swallowing.
This works because whenever an application that could be swallowed is launched by a terminal, the class of the terminal remains the same while the title changes to whatever the application's name is, thus letting it be matched against a regex.
Is it ready for merging, or does it need work?
The PR should be ready to be merged unless the config option name should be changed for some reason. Presumably the documentation will need to be updated as well.
Solves issue #2002