compton icon indicating copy to clipboard operation
compton copied to clipboard

Exclude opacity for specific programs

Open ghost opened this issue 7 years ago • 16 comments

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?

ghost avatar Oct 15 '17 17:10 ghost

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

0x041E avatar Oct 15 '17 18:10 0x041E

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 avatar Oct 16 '17 13:10 ghost

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

ghost avatar Oct 17 '17 15:10 ghost

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

0x041E avatar Oct 17 '17 17:10 0x041E

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 avatar Nov 03 '17 04:11 slackhead

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

slackhead avatar Nov 05 '17 01:11 slackhead

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

ghost avatar Nov 11 '17 20:11 ghost

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.

slackhead avatar Nov 11 '17 20:11 slackhead

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)

ghost avatar Nov 11 '17 20:11 ghost

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.

slackhead avatar Nov 11 '17 20:11 slackhead

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!

ghost avatar Nov 11 '17 20:11 ghost

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

slackhead avatar Nov 11 '17 20:11 slackhead

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

ghost avatar Nov 11 '17 20:11 ghost

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.

cesalazar avatar Mar 27 '18 17:03 cesalazar

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.

yshui avatar Aug 11 '18 18:08 yshui

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

dekonnection avatar Sep 14 '18 08:09 dekonnection