Skip to content

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

@JonnyHaystack

Description

@JonnyHaystack

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions