Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System tray icons overlap when changing status #2935

Open
hamensman opened this issue Oct 23, 2021 · 90 comments
Open

System tray icons overlap when changing status #2935

hamensman opened this issue Oct 23, 2021 · 90 comments

Comments

@hamensman
Copy link

hamensman commented Oct 23, 2021

Let's take the wifi (nm-applet ) and bluetooth (blueman-applet) system tray icons.

When I am connected to wifi and bluetooth is on, they look like this:
Screenshot_2021-10-23_00-54-29
If I disconnect wifi and disable bluetooth, they should look like this:
Screenshot_2021-10-23_00-54-58
But what actually happens is they end up overlapping on top of each other, looking like this:
Screenshot_2021-10-23_00-55-21

Right now, I would have to do a qtile restart if I wanted the icons to look as they should.

Using latest Qtile on Arch.

@elParaguayo
Copy link
Member

elParaguayo commented Oct 23, 2021

Thanks for reporting.

Can you share your config please and also let me know if there are any error messages in the logs.

Also, what icon set are you using? I can't really recreate with my icons.

@elParaguayo
Copy link
Member

Can't recreate. When toggling power state via the applet, the icon redraws correctly for me.

@m-col
Copy link
Member

m-col commented Oct 23, 2021

Is a compositor interfering possibly?

@hamensman
Copy link
Author

@elParaguayo

Here's my config: hamens_config.txt

Nothing in the error logs.

Using Arc icon theme.

@hamensman
Copy link
Author

hamensman commented Oct 23, 2021

Is a compositor interfering possibly?

I tried uninstalling picom. Interestingly blueman-applet now redraws as it should. But nw-applet still persists.

This is the picom.conf I use: https://github.com/arcolinux/arcolinux-qtile/blob/master/etc/skel/.config/qtile/scripts/picom.conf

@krive001
Copy link
Contributor

Same problem. This is an nm-applet bug.

@elParaguayo
Copy link
Member

Has anyone tried this in a different window manager to confirm that? If it happens in other WMs then the bug needs to be reported upstream and we can close this.

@krive001
Copy link
Contributor

Polybar and dwm bar good. Qtile, the systray is not updated

@elParaguayo
Copy link
Member

So it's not a nm-applet bug then.

@krive001
Copy link
Contributor

No.

@m-col
Copy link
Member

m-col commented Oct 24, 2021

What is the background of your bar (colors[0])?

@hamensman
Copy link
Author

What is the background of your bar (colors[0])?

I have my wallpapers change on startup (and I frequently change them every few times in session), so pywal changes the colour of colors[0] depending on the wallpaper.

@m-col
Copy link
Member

m-col commented Oct 24, 2021

Nice, and presumably the issue is the same no matter what the current state of that is? Do the colors ever have transparency?

@elParaguayo
Copy link
Member

Transparency does feel like a likely candidate here. However, if it was, I'd also expect a MatchError in the logs.

@hamensman
Copy link
Author

hamensman commented Oct 24, 2021

Nice, and presumably the issue is the same no matter what the current state of that is?

Correct.

Do the colors ever have transparency?

Yes.
I've also tried turning transparency off by setting opacity to 1. But also no difference. Only uninstalling picom, or doing killall picom made any difference (but again, nw-applet is still acting up). I'm not sure if the very presence of picom is messing something up.

@hamensman
Copy link
Author

Polybar and dwm bar good. Qtile, the systray is not updated

Have you tested system tray icons other than the ones I mentioned?

@krive001
Copy link
Contributor

For me, the problem was solved if I set the background for the bar this way.

screens = [
    Screen(
        top=bar.Bar(
            [
                currentlayouticon, sep, tasks, groupbox, space1, wigetbox, sep, wttr, sep, mem, sep,
                udate_tb, check_update, sep, sensor, sep, cpu, sep, emoji_volume, text_volume,
                sep, clock, sep, power, sep, systray,
            ],
            30,
            margin=[0, 0, 5, 0],
            background="#000000.0",
            opacity=1.0,
        ),
        left=bar.Gap(size=5),
        right=bar.Gap(size=5),
        bottom=bar.Gap(size=5),
    ),

]

@ervinpopescu
Copy link
Contributor

ervinpopescu commented Oct 25, 2021

opacity=1.0

helps, but like @hamensman i have the same issue with the nm-applet.
I still have some problems with the icon size(screenshot). I believe it's something else from #2438 though, as that has been fixed. The SysTray was behaving correctly(besides the overlap) before i changed the bar colors in the config, but again i highly doubt that was the issue.

Edit:
False alarm... the blueman-applet still doesn't work properly.

@elParaguayo
Copy link
Member

@ervinpopescu can you post your bar background value and whether you're using picom too.

It would be good if you could try testing with picom disabled and a fully opaque bar background (ie no alpha value).

@ervinpopescu
Copy link
Contributor

ervinpopescu commented Oct 25, 2021

Turns out that having background="#2e3440.0" is actually making the issue dissappear in thin air xD. I am using picom-ibhagwan-git with dual_kawase as the blur method. I will disable it, but it seems the issue is the opacity, as you do make it sound like.

Edit:
Wrong again xDxD, picom seems to be the issue... Without it, they switch on and off perfectly fine.

2nd edit:
My bad, I actually changed it back to without alpha when i was testing picom, now with alpha and picom, everything works fine...

background="#2e3440.9",
opacity=1.0

picom -f --blur-method dual_kawase --blur-strength 1 --corner-radius 5
The icon background is transparent as said in the documentation, but they are working smooth as silk.

If I use background="#2e3440", opacity=1.0 and I restart qtile (hoping it won't crash), the SysTray gets redrawn properly.

Should I open another issue for the icon size thing?

@elParaguayo
Copy link
Member

Yes. New issue for the size please. Ideally, please post enough detail for us to try to recreate.

@elParaguayo
Copy link
Member

I've lost track of this one.

Can anyone confirm if the overlapping is still an issue as I can't recreate it.

@ervinpopescu
Copy link
Contributor

Yes, it still is.

@CSpencerND
Copy link

Happens to me with volumeicon as well. I have my Systray inside a WidgetBox. Interestingly, collapsing and opening the WidgetBox corrects it without having to reload qtile.

@CSpencerND
Copy link

CSpencerND commented Nov 7, 2021

Check this out. I just woke my laptop from sleep and the Systray inside the WidgetBox is overlapping the other widgets.
2021-11-07_06-09
In this case, opening and closing the WidgetBox doesn't fix it.

@elParaguayo
Copy link
Member

Is volumeicon a systray app?

Can you post your config and a screenshot of the issue.

@CSpencerND
Copy link

I have some errors in the logs.

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/libqtile/hook.py", line 380, in fire
    i(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/libqtile/core/manager.py", line 332, in cmd_reconfigure_screens
    self._process_screens()
  File "/usr/lib/python3.9/site-packages/libqtile/core/manager.py", line 313, in _process_screens
    scr._configure(self, i, x, y, w, h, grp)
  File "/usr/lib/python3.9/site-packages/libqtile/config.py", line 289, in _configure
    self.set_group(group)
  File "/usr/lib/python3.9/site-packages/libqtile/config.py", line 348, in set_group
    g1 = self.group
AttributeError: 'Screen' object has no attribute 'group'

@CSpencerND
Copy link

CSpencerND commented Nov 7, 2021

Is volumeicon a systray app?

Yes.

Can you post your config and a screenshot of the issue.

I got you in a moment.

@CSpencerND
Copy link

@elParaguayo
my config

@CSpencerND
Copy link

Full volume
image

Muted
image

After unmuting
image

However, it doesn't always happen, and if I kill picom it doesn't happen at all.

@elParaguayo
Copy link
Member

Not sure what you're looking for but, if you run xprop and click on the the tray, you'll get the bar window.

To get the tray, you can do this:

qtile cmd-obj -o cmd -f eval -a "self.windows_map"

That will give you something like this:

(True,
 '{4194592: Internal(wid=4194592), 4194596: <libqtile.widget.systray.Systray '
 "object at 0x7fcf5dece280>, 6291458: Window(name='Alacritty', wid=6291458), "
 "20971522: Window(name='Alacritty', wid=20971522)}")

You can then run xprop -id 4194596 and get

_NET_SYSTEM_TRAY_VISUAL(VISUALID): visual id # 0x21
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0

As you can see, the tray advertises the visual id that should be used by apps to display their icons.

@krive001
Copy link
Contributor

That's all I wanted to say. I understand the rest.
2021-11-10_17:08:59
2021-11-10_17:21:58

@elParaguayo
Copy link
Member

elParaguayo commented Nov 10, 2021

OK. What am I meant to be looking at in those screenshots? Is it the cmd-obj point? If so, that's unrelated to this issue.

@krive001
Copy link
Contributor

krive001 commented Nov 10, 2021

I don't have time to code. I hope they solve the problem.

@elParaguayo
Copy link
Member

Can I suggest you start a discussion on this so we don't fill up the issue with questions about the widget.

@github-actions
Copy link

github-actions bot commented Feb 8, 2022

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@nullbyto
Copy link

nullbyto commented Aug 5, 2022

I'm having the same issue with blueman-applet. And the only way to get rid of that is to stop picom.
Did anyone solve it ?

One thing I noticed, I didn't face this issue on my Fedora install. After installing Arch with qtile with the same config, it started happening, which is really odd.

@michaelmyc
Copy link

@elParaguayo This issue shouldn't be closed. It clearly hasn't been fixed yet.

For me, there is overlap in the icons when the bar background is set to a solid color (as shown in the original screenshots). Apparently, some reported that this issue does not happen on Fedora. I wonder if some newer versions of qtile or picom or other relevant packages broke this. It would be great if we could get the package versions on a system without these issues so I could test this theory.

If I set the bar to have any transparency, the systray icons will have a fully transparent background rather than the transparency set in the bar. This is already documented in the documentation.

Some reported that it's an issue with picom, but this is actually not the case. I'm experiencing this issue with two different systray icons: NetworkManager, and ibus. NetworkManager seems to be fixed when I kill picom, but ibus still exhibits the weird overlaying. I also tried xcompmgr, and I see the same overlaying behavior.

I ran the following commands as suggested to check depth when using a transparent and a non-transparent background:

qtile cmd-obj -o bar top -f eval -a "self.drawer._visual.visual_id"
qtile cmd-obj -o widget systray -f eval -a "self.drawer._visual.visual_id"

I'm getting weird results. For non-transparent bar, I'm getting:

(True, '33')
(True, '33')

For transparent bar, I'm getting:

(True, '35')
(True, '35')

I'm running qtile 0.22.1 on Arch (EndeavourOS).

@michaelmyc
Copy link

Also, since I can recreate this issue, I'm happy to assist with testing.

@elParaguayo
Copy link
Member

Those two numbers are not the depth, they're the ID of the visual being used to display the icons. The bar and the widget should have the same ID which they do so that's good.

Do you have another window manager installed? As System Tray is an X specification, it would be good to know if the same issue arises on that WM too or whether this is because of qtile's implementation.

@elParaguayo elParaguayo reopened this Dec 13, 2022
@michaelmyc
Copy link

I don't have another window manager, but I installed polybar and polybar's systray doesn't suffer from this issue.

@michaelmyc
Copy link

I tested polybar with transparency as well. It also doesn't suffer from the semi-transparency issue qtile bar is suffering from. I also tested trayer with and without transparency. No issues for me. I'm digging into polybar source code to see if I can find anything relevant.

@elParaguayo
Copy link
Member

I suspect they're doing some form of pseudo-transparency where they take the surface underneath the bar and copy that image to the tray.

@michaelmyc
Copy link

michaelmyc commented Dec 16, 2022

OK, so after a little digging, it seems like polybar is using pseudo-transparency, meaning it draws the at the semi-transparent background, and then adds the contents (systray) on top. I believe they are basically creating an illusion that there's semi-transparency, while not using true transparency. This is likely the technique they're using to achieve transparency: https://en.wikipedia.org/wiki/Pseudo-transparency

Seems like they're drawing the main surface on the main context, and then drawing the background color over the main surface, and then refreshing the windows (tray icons) on top. I haven't used cairo before so I might have gotten some concepts wrong here.

Here's the source code of how they're redrawing the background:
image
image

This PR to disable redrawing the tray when transparency is not present further hints on this process: polybar/polybar#2604

@michaelmyc
Copy link

I suspect they're doing some form of pseudo-transparency where they take the surface underneath the bar and copy that image to the tray.

You're absolutely on point.

@michaelmyc
Copy link

Going to poke around the source code to see if I can hack together something. Need to set up dev environment so I can have a local build running tho.

@elParaguayo
Copy link
Member

It's complicated, as I recall we need to use the Composite function from the XRender extension.

I might give this another look as it's definitely a suboptimal outcome at the moment but it's probably going to be hard!

@elParaguayo
Copy link
Member

Also, I think this would need to implemented at the bar level rather than the widget level.

@musjj
Copy link

musjj commented Sep 5, 2023

I'm also having this issue. My tray icons worked fine when I was using AwesomeWM, maybe we could look at their implementation for reference?

@elParaguayo
Copy link
Member

I had a working implementation of this a while ago (#4126). It didn't get merged as we had some other priorities. I can pick this up again after the next release (that's current priority) as it will need to be updated to reflect some other changes to our code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants