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

Add a way to map from a window properties filter to a new set of swallow values #94

Open
JonnyHaystack opened this issue Oct 17, 2020 · 1 comment
Labels
enhancement New feature or request
Projects
Milestone

Comments

@JonnyHaystack
Copy link
Owner

JonnyHaystack commented Oct 17, 2020

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:

  1. Allow window_swallow_criteria to map using a window property filter just like window_command_mappings (Allow window_swallow_criteria to be mapped using window property filters just like window_command_mappings #93)
  2. Implement regular expressions for window filters (including swallow criteria) (Use regular expressions for window filters in config #92)
  3. 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.

@JonnyHaystack JonnyHaystack created this issue from a note in 2.0 (To do) Oct 17, 2020
@JonnyHaystack JonnyHaystack changed the title #### Add a way to map from a window properties filter to a new set of swallow values Add a way to map from a window properties filter to a new set of swallow values Oct 17, 2020
@JonnyHaystack JonnyHaystack added this to the 2.0.0 milestone Oct 17, 2020
@aarobc
Copy link

aarobc commented Jun 25, 2021

Seeing as this is scheduled for v2 yet there is not yet a v2 branch, are you accepting PRs for this feature?

This would be enormously useful.

@JonnyHaystack JonnyHaystack added the enhancement New feature or request label Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
2.0
To do
Development

No branches or pull requests

2 participants