Skip Navigation

Help with swaywm window rules?

Fellas, I'm at my wit's end with this one. I'm trying to set a general rule for window opacity in sway, and then have a few programs excepted from it.

Back on i3 with picom, I could do this pretty easily by setting activeOpacity to 0.9, for example, and then specifying additional opacityRules like this:

 undefined
    
"100:class_g = 'mpv'"
"100:class_g = 'Brave-browser'"

  

Likewise, hyprland's window rules made it pretty easy to override the general opacity rules as well.

I can't seem to get this on sway, though; if I set it up like this:

 undefined
    
[app_id=".*"] opacity 0.85

[app_id="brave-browser"] opacity set 1
[app_id="librewolf"] opacity 1


  

it simply sets everything to 0.85.

Currently, I have this:

 undefined
    
[app_id="^(?!mpv$|brave-browser$).*$"] opacity 0.85

[app_id="brave-browser"] opacity set 1
[app_id="mpv"] opacity 1


  

but it is still exhibiting the same behavior (except mpv also seems to totally disregard any opacity rules whatsoever).

Any help is greatly appreciated---I haven't been able to find anyone else asking or talking about what seems to me like pretty basic functionality.

UPDATE:

Months later, I have it working—it seems my regex was incorrect. Indeed, you cannot apply opacity rules twice (once with a wildcard, and again for specific windows after), so the way to do it is with a regex like this:

 undefined
    
for_window {
  [app_id="^(?!brave-browser$)(?!mpv$).*"] opacity 0.8
}


  

You're viewing a single thread.

3 comments