chjj / compton

A compositor for X11.
Other
2.24k stars 501 forks source link

Exclude opacity for specific programs #450

Open ghost opened 6 years ago

ghost commented 6 years ago

There are multiple options to exclude specific behaviors (shadows, fade effects, etc) but there's nothing for the opacity. How can I disable opacity (setting it to 1.00) for specific programs?

0x041E commented 6 years ago

There already is option called opacity-rule with which you can set opacity for certain program for example opacity-rule = [ "80:class_g = 'URxvt'" ]; would set windows with class URxvt to 80% opacity just replace it with any value you need and it should work

ghost commented 6 years ago

My bad! I guess it didn't work at first because I didn't enter a XX: value before the class.. How is that there are empty rules ( ex: fade-exclude = [ ]; ) for whatever-rule but not for opacity?

ghost commented 6 years ago

I'm sorry but it looks like 1) I can't have a 100% opacity and B) I have fullscreen videos still transparent..

0x041E commented 6 years ago

The first part i'm not sure why 100 doesn't work maybe 99 might be enough but for the second part depending on browser i remember that at least firefox creates window with different classname for fullscreen i think it was either "plugin-container" or "Navigator" as classname but not sure right now(you can check that yourself with xprop) so you could set that to always be focused or the opacity rule should work

slackhead commented 6 years ago

I can't seem to get opacity-rule to work. I take it that it goes in ~/.config/compton.conf? This is what I used:

opacity-rule = [ "100:class_g = 'Smplayer'" ];

This is what xprop outputs:

WM_CLASS(STRING) = "smplayer", "Smplayer"

I've tried both strings, but I can't seem to stop smplayer going slightly transparent. Same for mplayer.

Any ideas?

slackhead commented 6 years ago

Ok I found the reason. Compton needed to be started via dbus-launch.

ghost commented 6 years ago

@slackhead can you explain what did you do? 100 opacity isn't working for me

slackhead commented 6 years ago

In your WM startup file you must use:

dbus-launch compton (options) &

That works for i3. I haven't tried it in fluxbox yet, but I'm sure that it will. If you use something like XFCE, Gnome or KDE you'll have to find a way to launch it like that.

I hope that helps.

ghost commented 6 years ago

I used exec_always dbus-launch compton -CG --config ~/.config/compton.conf & in my i3 config file and it launches compton but it ignores somehow the 100 value. it works only until 99, if there's 100 it simply ignores the line.. Can't tell why it behaves like this (I'm using arch and i3wm btw)

slackhead commented 6 years ago

Yeah, you're right. I checked again and it does ignore 100%. 99% seems to = 100 opacity, or as near as I can tell.

I used compton-conf to set everything to 1.0 by default, which does work. My remark about using dbus-launch was more to do with making windows fully opaque, because some were semi-transparent without dbus.

ghost commented 6 years ago

I compromised making every window fully opaque by default and setting custom opacity via opacity-rule for all the programs I want to be transparent. The only problem I have here is that compton makes lemonbar fully transparent somehow but nobody answered my issue about that for a month. Maybe one day.. Thanks anyway you made me rethink how I was setting compton and now I almost have the configuration I wanted!

slackhead commented 6 years ago

If you can find the window class for lemonbar you might be able to fix it.

ghost commented 6 years ago

it looks like it ignores it. the class is Bar but no matter what I enter it doesn't affect it anyway

cesalazar commented 6 years ago

I was able to achieve 100% opacity for Firefox by setting active-opacity = 1; (I don't want transparency by default) and not including Firefox on opacity-rule. Then restarted both compton and i3 for the change to be applied.

Restarting compton alone didn't reset the opacity for the running instance of Firefox.

yshui commented 6 years ago

Hello, I had an attempt at fixing this problem, by allowing setting opacity to 100 with rules. If you could give yshui/compton@30c14c06d2eef008a7eeb3c0e23d8a08c8ba37e1 (i.e. the opacity branch) a try, and report back, that will be much appreciated.

dekonnection commented 6 years ago

Hello, I had an attempt at fixing this problem, by allowing setting opacity to 100 with rules. If you could give yshui/compton@30c14c0 (i.e. the opacity branch) a try, and report back, that will be much appreciated.

Can confirm, the fix is working for me :)