You are not logged in.

#1 2021-07-16 08:32:15

newsboost
Member
Registered: 2016-07-24
Posts: 157

[SOLVED] picom (used with i3): would like "active" dimming / darker bg

Hi all,

I'm struggling a bit with picom (used together with i3). I have a lot of background images and have this line inserted in my i3-config file:

exec_always --no-startup-id feh --randomize --bg-max /home/myuser/Desktop/wallPaperAccess

So it gives me a random background each time I reload the i3 config, which is nice for variety. The problem is that very often there are some very bright parts in the background images and when I use the terminal window, it's difficult to read the text when the background image is too bright. So I found out there's an "inactive-dim = 0.2;" setting which automatically dims the background for non-active windows - I would like the exact same for active windows, i.e. the background should be dimmed (=made darker) so the risk of having too bright backgrounds is reduced. I know I can probably automatically change all the images via e.g. "convert/imagesmagick" or so - but that would require me to have a duplicate of all images, which I don't think is a nice solution... Does anyone know how to solve this problem, i.e. make all backgrounds e.g. 20% darker without re-writing the images themselves?

I've also struggled with the "glx"-backend - I have the "NVIDIA GeForce GTX 1070 Mobile" graphics card. Maybe that is required, but the text becomes blurry in inactive windows when I enable the glx backend. Otherwise I think, maybe the "max-brigthness"-setting would be the solution... But then again: When "inactive-dim = 0.2;" works, it would be really nice with something like "active-dim = 0.2;" also... Does anyone know a solution to this problem?

Picom is started with this command, from the i3 config:

exec_always --no-startup-id "killall -q /usr/bin/picom; /usr/bin/picom --xrender-sync-fence --config ~/.config/picom/picom.conf -b"

And here's my picom-config:

#WARNING: "glx" BACKEND MAKES THINGS LOOK BLURRY, THUS DISABLING IT - CAN'T MAKE IT WORK
#backend = "glx"
#Attempt at fixing: Screentearing with NVIDIA's proprietary drivers - not working
#vsync = true;
#
#Attempting hybrid solution - also not working, so disabling it:
#backend = "xr_glx_hybrid"

# Dim inactive windows (higher value=darker) - this works and is nice - but would like the same effect for "active" windows, how to accomplish that?
inactive-dim = 0.2;

# max-brigthness - this probably require the experimental "glx" backend - doesn't work, nothing happens (so disabling it):
#max-brigthness = 0.1

glx-no-stencil = true;

opacity-rule = [
 "100:class_g = 'Alacritty' && !_NET_WM_STATE@:32a",
 "0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'",
 "0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'",
 "0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'",
 "0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'",
 "0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'" ];

Finally (not important), but I don't understand why the last part (with the "_NET_WM_STATE_HIDDEN"-lines) works, e.g. what does "32a" mean? I know I need those lines to avoid transparency on top of transparancy for tabbed windows, I just don't understand why it works?

Can anyone help with any guidance or comments? Any help will be greatly appreciated, thanks!

Last edited by newsboost (2021-07-19 13:38:34)

Offline

#2 2021-07-16 11:30:27

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,432

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

The dimming will just make everything darker…
Also what if the image is too dark and the window uses dark text on a bright background?
Finally, processing windows is more expensive.

Try

display +contrast -gamma 0.8 -gravity center -sample '1920x1200^' -crop 1920x1200+0+0 -window root /path/to/wallpaper.jpg

32a defines the property type (32-bit atom)

For nvidia/blurry text, make sure you don't have fxaa enabled in nvidia-settings.

For the future, please don't create shopping list threads covering multiple different questions at once.
They're horrible to maintain and of less value for future readers.

Edit: thought you might also be interested in lowering the contrast

Last edited by seth (2021-07-16 11:41:48)

Offline

#3 2021-07-17 01:19:33

newsboost
Member
Registered: 2016-07-24
Posts: 157

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

seth wrote:

The dimming will just make everything darker…
Also what if the image is too dark and the window uses dark text on a bright background?
Finally, processing windows is more expensive.

hmm, seems there's a difference between working on my work pc and my home pc. I agree the dimming makes everything darker, which is exactly what I need on my work pc. For some reason, things aren't behaving the same on my private and on my work laptop pc's. Now I'm at home and when I press mod+enter i3 automatically opens up a new "alacritty"-window with opaque background, but the inactive windows are transparent. This is actually pretty nice. I also think the font on my work pc was completely white but it's more gray'ish on my home pc. So on my work pc, I needed a darker background in order to be able to read the very bright white font clearly, which was always transparaent (at home the active window isn't transparent even with the same picom.conf-file, hmm, I must have messed with another config-file somewhere)...

seth wrote:

Try

display +contrast -gamma 0.8 -gravity center -sample '1920x1200^' -crop 1920x1200+0+0 -window root /path/to/wallpaper.jpg

Ok, thanks, but that doesn't change anything. I ran the command on my home pc, nothing happened. I'm using "feh" to set the background, As far as I understand it, the "display" command is not for setting a background image, it just opens up a new window to show a picture in - but in this case, it does absolutely nothing at all, it just exits with a return value of "1", but no error messages. Did I misunderstand how to use this command?

seth wrote:

32a defines the property type (32-bit atom)

For nvidia/blurry text, make sure you don't have fxaa enabled in nvidia-settings.

For the future, please don't create shopping list threads covering multiple different questions at once.
They're horrible to maintain and of less value for future readers.

Edit: thought you might also be interested in lowering the contrast

Ok, thanks a lot about the "32a", let's not discuss that further then and sorry about asking (I thought it was a bit related, but I understand your point). About the blurry text: Thanks, I'll check on my work pc. It seems like all my problems are with my work pc and not my private home laptop, where the GPU is "NVIDIA GeForce RTX 2060 Mobile". Maybe the RTX 2060 (home laptop) has better linux drivers than the GTX 1070 (work laptop)? Hmm, damn, I cannot reproduce the problems before I'm back at work on monday. But I'll definately check the "FXAA" / "Antialiasing Settings" from nvidia-settings, thanks!

About lowering the contrast: I guess you're right that both dimming and reduced contrast will help on transparent terminal windows, but the real issue is that I think I did not understand how to use the "display +contrast......"-command you described, because nothing really happens here on my home laptop when I run that. Could you please explain if that is a replacement for "feh" or how that darkens the background or how I should use the command? If so I'll be very happy, thanks a lot so far!

UPDATE: hmm, seems like the "active-opacity = 1.0" setting works here at home so if I use that on my work laptop I should have no problems with the background. This will solve my problem with having difficulties reading the white terminal text font on a bright background image... But I'm astonished how much better things work here at home compared to at work, e.g. also the "glx"-backend works here - that doesn't work on my work laptop, maybe that's also part of the reason why I have problems...hmm...

Last edited by newsboost (2021-07-17 01:49:39)

Offline

#4 2021-07-17 06:43:19

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,432

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

alacritty is an argb window, you might have different configs where one has a transparent background and the other doesn't - but that's alacritty.

Did you blindly copy-and-paste the display command or did you provide a valid wallpaper path?
display "displays" iamges, but it can do so in any window - in this case the root window.
Also adjust the geometries in doubt.

Offline

#5 2021-07-17 14:38:10

newsboost
Member
Registered: 2016-07-24
Posts: 157

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

seth wrote:

alacritty is an argb window, you might have different configs where one has a transparent background and the other doesn't - but that's alacritty.

Right, I must check on monday from the office. At least now I've seen that it can work nicely - but that's also with the glx-backend, I think I have some problems with the graphics driver for the work laptop pc... Anyway: I tried to google "aRGB window linux" and similar but don't really understand what it means that "alacritty is an argb window"... Maybe it's not important, though, so: In any case:

seth wrote:

Did you blindly copy-and-paste the display command or did you provide a valid wallpaper path?
display "displays" iamges, but it can do so in any window - in this case the root window.
Also adjust the geometries in doubt.

Here's what I did:

$ ls -l angel_light_field_83493_1920x1200.jpg 
-rw-r--r-- 1 user user 746649 Jul 17 16:06 angel_light_field_83493_1920x1200.jpg

$ file angel_light_field_83493_1920x1200.jpg 
angel_light_field_83493_1920x1200.jpg: JPEG image data, baseline, precision 8, 1920x1200, components 3

$ display +contrast -gamma 0.8 -gravity center -sample '1920x1200^' -crop 1920x1200+0+0 -window root angel_light_field_83493_1920x1200.jpg   
$ echo $?
1

$ display -verbose +contrast -gamma 0.8 -gravity center -sample '1920x1200^' -crop 1920x1200+0+0 -window root angel_light_field_83493_1920x1200.jpg
angel_light_field_83493_1920x1200.jpg JPEG 1920x1200 1920x1200+0+0 8-bit sRGB 746649B 0.020u 0:00.021

$ echo $?
1

I also tried omitting the "-sample ..." and "-crop ..." options because my screen resolution is actually 3840x2160 so what "feh" does is maximize to fit the screen. But even if "display" just centered the image, it doesn't do anything. The last command works, but opens up a new window instead of changing the background image. I also tried "ltrace" and "ptrace" but there's too much output to show. But this however works:

$ display angel_light_field_83493_1920x1200.jpg 
$ echo $?
0

$ display -verbose +contrast -gamma 0.8 -gravity center -sample '3840x2160^' angel_light_field_83493_1920x1200.jpg  
angel_light_field_83493_1920x1200.jpg JPEG 1920x1200 1920x1200+0+0 8-bit sRGB 746649B 0.020u 0:00.021
$ echo $?
0

So let's just keep it simple:

$ display angel_light_field_83493_1920x1200.jpg  
$ echo $?
0

$ display -window root angel_light_field_83493_1920x1200.jpg                                                                    
$ echo $?
1

So it doesn't seem to permit the "-window root"-option. I even tried the latter as root, but with the same error code and problem so even being root doesn't help. I have multiple screens/monitors connected, if that makes any difference (didn't try to disconnect the external monitors though as I assume your command works for all screens?). Any ideas?

Offline

#6 2021-07-17 15:06:51

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,432

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

I even tried the latter as root

Don't - the root user and root window have no relationship beyond the dictionary term.

xwininfo -int -root

?

Offline

#7 2021-07-18 15:15:50

newsboost
Member
Registered: 2016-07-24
Posts: 157

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

Hi seth,

Ok, I figured out what the problem was: picom was running in the background while I tried the "display"-command, which won't work. Killing picom will make the command work!
So I can see that instead of the "feh"-command I'm currently using:

exec_always --no-startup-id feh --randomize --bg-max /home/martin/Desktop/wallPapers_nice/*.jpg

I can use something like (and add options for gamma and contrast)...:

exec_always --no-startup-id display -gravity center -window root $(ls | sort -R | head -1)

I played a bit with it, added several +contrast options and a low gamma-value. However the problem is that the image quality decreases a lot, when making the background relatively dark... For that reason, I'm thinking that it's best with "active-opacity = 1.0" (or a very high value) and see if my work-pc responds correctly to that command as it does here at home (where I also added "fading=true;" which is really nice). I don't remember I had that command with a low "active-opacity" value but I do remember that the terminal foreground font color was white and that caused problems with the light parts of the background. At home all backends work, but I remember that at work only the software "xrender'-render works, furthermore I had various problems, e.g. I'll have to check the "nvidia/blurry text"-problem" and suggestion "make sure you don't have fxaa enabled in nvidia-settings". I'm crossing my fingers and hopefully things will work perfectly tomorrow. If everything works nicely, I'll close this thread with [SOLVED] - thanks a lot so far, really appreciate the help and ideas/suggestions, thanks!

Offline

#8 2021-07-19 08:26:37

newsboost
Member
Registered: 2016-07-24
Posts: 157

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

About:

make sure you don't have fxaa enabled in nvidia-settings"

Thanks, that worked! Blurrying is gone and "glx"-backend has been enabled on both my computers.

But I think the best solution to my problem is to have "active-opacity = 1.0" working. But it doesn't work on my work pc - only my home pc. I don't understand why? It's like it's being ignored or maybe "overwritten somewhere else, I don't know. I enabled the "glx" backend on my work pc (after disabling fxaa in nvidia-settings) just as on my home pc - for some reason picom doesn't work the same and having "active-opacity" working is the best solution to avoid bad image quality I think... So I'm stuck. If anyone know why or have ideas, appreciate it, thanks!

Offline

#9 2021-07-19 11:36:56

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,432

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

This is likely not an "active opacity" thing but your alacritty configuration - notably the background color/alpha.
It's not in picom, but in alacritty.
Look at the alacritty configurations. Notably the "background_opacity" value …

Offline

#10 2021-07-19 13:37:51

newsboost
Member
Registered: 2016-07-24
Posts: 157

Re: [SOLVED] picom (used with i3): would like "active" dimming / darker bg

seth wrote:

This is likely not an "active opacity" thing but your alacritty configuration - notably the background color/alpha.
It's not in picom, but in alacritty.
Look at the alacritty configurations. Notably the "background_opacity" value …

Oh, you're right. I feel so stupid now, had no clue that also was an option there (but I should've tried alternative term emulators and I would've quickly understood it, sorry about that). Just for the reference: I had "background_opacity: 0.5" which probably looked "cool" at some time but the value should be much higher to avoid problems with bright regions in background images... So cool, thanks a lot man! Will mark as solved and I'm really happy now, thanks!

Last edited by newsboost (2021-07-19 13:40:06)

Offline

Board footer

Powered by FluxBB