this post was submitted on 31 May 2024
17 points (94.7% liked)

Linux

48073 readers
698 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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:

"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:

[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:

[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.

top 3 comments
sorted by: hot top controversial new old
[–] SavvyBeardedFish@reddthat.com 6 points 5 months ago* (last edited 5 months ago) (1 children)

Running: swaymsg for_window "[app_id=mpv] opacity 0.5"

Works as expected on my end, are you missing just executing for_window?

Note, you can also add multiple rules in the same execution, e.g.

for_window {
    [app_id=mpv] opacity 0.85
    [app_id=LibreWolf] opacity 0.85
}

Also, note that app_id of LibreWolf is capitalized in that manner. You can get that information [app_id, shell etc] by running swaymsg -t get_tree

[–] gramgan@lemmy.ml 2 points 5 months ago (1 children)

I guess I should have written the post a bit more clearly. I’ve got the for_window part, it’s just that after I set the opacity for all windows app_id=.*, the following lines of the config cannot override that for the specific windows I want different opacities for.

[–] nore@sh.itjust.works 3 points 5 months ago

My guess is that sway checks sets the opacity when the window open, so when the first rule matches (app_id=.*) it skips all others, so maybe try putting the other 2 rules above the first one?

Sorry if my comment is incomprehensible, I've just woken up.