Rule to allow tearing for all games launched via Steam in Sway and Hyprland

Zenzio@fedia.io to Linux Gaming@lemmy.ml – 30 points –

So both Sway and Hyprland now support Waylands' tearing protocol. I was wondering whether it is possible to create window rules for these WMs that allow tearing in all games launched via Steam. Something like: For Sway for_window [class="steam_app_*"] allow_tearing yes

and for Hyprland windowrulev2 = immediate, class:^(steam_app_*)$

Does anybody know whether something like this would work? You know, instead of having to create an entry for every single game.

Edit: As mranderson17 said, allow tearing isn't in the latest release versions of Sway or Hyprland at the time of writing.

Edit2: mranderson17 gave what could possibly be the right answer:

For Sway for_window [class="steam_app_.*"] allow_tearing yes

For Hyprland (maybe) windowrulev2 = immediate, class:^(steam_app_.*)$

I haven't tested it yet. But unless you think he's wrong give him your "thumbs up".

10

You are viewing a single comment

Are your games all wine/proton games? For me in sway they all have the same class followed by some uid thing:

] > swaymsg -t get_tree
[...]
  #92: output "DP-5"
    #70: workspace "21"
      #126: con "Automobilista 2" (xwayland, pid: 171976, instance: "steam_app_1066890", class: "steam_app_1066890", X11 window: 0x5400001)

Or gamescope:

] > swaymsg -t get_tree
[...]
  #92: output "DP-5"
    #70: workspace "21"
      #124: con "Assetto Corsa" (xdg_shell, pid: 170694, app_id: "gamescope")

EDIT: Also allow_tearing was added to master 3 weeks ago, so this is definitely not in the current release. FYI to anyone who might try it.

I usually don't use gamescope. So I'm looking at the first of your two examples and I'm not sure I follow. The class is "steam_app_1066890", right? The number at the end should change with every game installed by Steam. It's a unique identifier Steam seems to use for all the games on Steam. So how does the class stay the same for your games? And thanks for noting that allow_tearing isn't in any current release at the time of writing. It's the same for Hyprland. I should have mentionend that.

Ah, I should have been more clear. The CRITERIA section of the sway documentation states that class matches support regex, so instead of using a * as you did in your example you'd use a regex any .*. So I think (untested of course) that for_window [class="steam_app_.*"] allow_tearing yes should work.

The comment in the code for allow_tearing notes that it must be enabled on the output as well. Here is the relevant output documentation. There are several other notes/recommendations there as well you should probably pay attention to.

Thank you, I will add this to my Sway config (and change it for Hyprland as well).