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

swallow: Add swallow_exception_regex #2026

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

mrkajetanp
Copy link
Contributor

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

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.
@vaxerski
Copy link
Member

overall ok, make a wiki mr plox

@mrkajetanp
Copy link
Contributor Author

overall ok, make a wiki mr plox

Wiki PR submitted, it's mentioned above

@vaxerski
Copy link
Member

discrepancy: in the wiki you say regex for the child, while here you match against the parent?

@mrkajetanp
Copy link
Contributor Author

Hm I think it probably makes more sense for it to be described this way in the wiki context?

As in we have a parent (Kitty) that spawns a child process (wev). At that point the title of that Kitty instance changes to 'wev' which is why that's what we match against.

I think emphasising 'child' on the wiki makes it easier for people tell which names go into which regex but if you have a better way to phrase this that's fine by me.

@vaxerski
Copy link
Member

you can add that note, but since you match the parent, you should state you match the parent. Shells/terms might have different methods of handling shit

@mrkajetanp
Copy link
Contributor Author

Fair enough, I updated the PR, how about this?

@vaxerski
Copy link
Member

yeah lgtm

@vaxerski vaxerski merged commit efee6a1 into hyprwm:main Apr 12, 2023
6 checks passed
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