-
-
Notifications
You must be signed in to change notification settings - Fork 24
Description
This would allow us to match a window that could have a dynamic title and set it up so that its placeholder will swallow any window matching a custom regex.
Actually there's a simple way to achieve this:
- Allow
window_swallow_criteriato map using a window property filter just likewindow_command_mappings(Allow window_swallow_criteria to be mapped using window property filters just like window_command_mappings #93) - Implement regular expressions for window filters (including swallow criteria) (Use regular expressions for window filters in config #92)
- Make it so the placeholder window uses the regex filters used for the swallow criteria as the values to swallow for those criteria
Sounds like the perfect solution to me. It should work so well that users don't even notice, and it doesn't add any extra confusing configuration to the config file.
To provide a somewhat similar example to #92 and #93, imagine this scenario:
- One window we want to save is the game window for PCSX2, a PlayStation 2 emulator
- The window title changes dynamically and contains the current framerate among other things
This means that the window cannot be swallowed by title correctly unless the framerate happens
to exactly match what it was when the workspace layout was saved.
Here is a configuration example that (with this new feature being implemented) would solve this:
{
...
"window_swallow_criteria": {
{
"class": "^PCSX2$",
"title": "^Kingdom Hearts [0-9]*FPS - PCSX2$",
"swallows": ["class", "instance", "title"]
}
}
...
}
When saving the layout, the swallow criteria rule would match the game window and overwrite the title of the placeholder window with the regex that we used for the filter. This means that the placeholder window will now swallow any window that matches our regex, so the game window will be swallowed correctly regardless of the current framerate of the game.
Note: The class name and title regex in the example above were made up on the spot and in reality the regex could be much simpler. I just wanted to give an example that shows a glimpse of how precisely you could match windows.