JonnyHaystack / i3-resurrect

Simple solution to saving and restoring i3 workspaces
GNU General Public License v3.0
378 stars 19 forks source link

Use regular expressions for window filters in config #92

Open JonnyHaystack opened 4 years ago

JonnyHaystack commented 4 years ago

This would be very useful in order to make different window command mappings and swallow criteria mappings for windows that have the same class and instance and also have dynamic titles. This is also a necessary step on the road towards mapping windows matching filter criteria (such as the current window_command_mappings criteria to placeholder windows that swallow custom regex values (mainly just for the title).

An example use case for this feature would be:

With this new feature, I would be able to create a swallow criteria mapping like so:

{
  ...
  "window_swallow_criteria": {
    {
      "class": "^Alacritty$",
      "title": "nvim",
      "swallows": ["class", "instance"]
    }
  }
  ...
}

This rule would match any window with the class "Alacritty" and a title containing "nvim" and override the swallow criteria of those windows so that the title would not be required to match.

One might have observed that this is not that helpful on its own, seeing as that window might now end up swallowing any other Alacritty window, which is most likely undesirable. However, the main goal here is actually to enable #94.