Closed r7eyes closed 3 months ago
No idea at the moment. The python-dasbus package has been flagged out of date some time ago ("Need to Rebuild"). Maybe this is going to help?
BTW: running Discord from the terminal reveals plenty of error messages, e.g.:
Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
This module exceeds my skills by the way. @christian-schulze - any idea?
I experience this issue as well as mentioned in #248.
I wonder if my other issue is also related - are desktop notifications affected as well? For some apps it does not show the app icons but a placeholder. For example Slack and Network Manager notifications do not have proper icons next to the notification while notifications from the browser do. Please see the screenshot below
It affects all Electron apps, as far as I know.
If it comes to notifications: swaync is a third party app, so you need to ask for help on their repository.
Interestingly enough the icon for nextcloud also does not show up. To my knowledge it isn't an electron app. I don't know if this is related, because it behaves slightly differently. Discord show a blank space that can not be clicked as an icon, whereas nextcloud shows nothing.
I have to icon of gnome-encfs-manager working, so I know it works at least.
just ran into this one with the latest nwg-shell packages on hyprland. in addition to electron packages, I've found that heroic game launcher's tray icon doesn't work, as well as blueberry-tray
for bluetooth management.
Electron apps stopped displaying tray icons months ago. See several other issues. Unfortunately we still have no solution. :(
Electron apps stopped displaying tray icons months ago. See several other issues. Unfortunately we still have no solution. :(
BTW. Great piece of software! Nicely done and quick and easy to configure! I'm now using drawer, panel, dock, displays bits from your repository! This issue is probably a tiny issue, just a problem to debug I suppose. Unfortunately I can' t really help either.
I don't have much experience with using DBUS, so apologies in advanced as I might be using very incorrect terminology, but maybe the info I found will be useful? From listening to the dbus while having nwg-panel
and waybar
both activated I was able to follow and see if I could get the StatusNotifierItem properties. Basically there's an extra step that nwg-panel
needs to follow.
When discord starts up, nwg-panel
tries to register the StatusNotifierItem (https://github.com/nwg-piotr/nwg-panel/blob/master/nwg_panel/modules/sni_system_tray/host.py#L78) using a service name that looks like org.kde.StatusNotifierItem-xxxxxx-1
where the x
is some number, and object_path
of /StatusNotifierItem
. This results in nothing.
We need to call the DBUS to GetNameOwner
of that service, then we call that service directly with GetAll
to get the properties of the StatusNotifierItem. I introduced a simple if-block that achieves it:
service_name, object_path = get_service_name_and_object_path(full_service_service)
# Handle the case for Discord
if object_path == "/StatusNotifierItem":
dbus = self.session_bus.get_proxy('org.freedesktop.DBus', '/org/freedesktop/DBus')
owner_name = dbus.GetNameOwner(service_name)
# Results in some thing like `:1.xxxx`
print(f"Owner of {service_name} is {owner_name}")
object_path = '/StatusNotifierItem'
sni_proxy = self.session_bus.get_proxy(owner_name, object_path)
sni_properties = sni_proxy.GetAll('org.kde.StatusNotifierItem')
for property_name, property_value in sni_properties.items():
# Prints the properties like "IconPixmap, Status, etc."
print(f"{property_name}: {property_value}")
if self.find_item(service_name, object_path) is None:
item = StatusNotifierItem(service_name, object_path)
item.set_on_loaded_callback(self.item_loaded_handler)
item.set_on_updated_callback(self.item_updated_handler)
self._statusNotifierItems.append(item)
However I'm not sure how to integrate this into the library, because of how we need to get a proxy and then call "GetAll" on it to get the properties, while it looks like the current implementation is able to access the properties directly on the proxy.
BTW. Great piece of software! Nicely done and quick and easy to configure! I'm now using drawer, panel, dock, displays bits from your repository! This issue is probably a tiny issue, just a problem to debug I suppose. Unfortunately I can' t really help either.
Thank you! I had no idea how to fix it so far, but let's learn what @agentx3 comes up with.
I don't have much experience with using DBUS, so apologies in advanced as I might be using very incorrect (...)
Thank you very much for your effort. It's too late tonight, but I'll check out your findings tomorrow.
while it looks like the current implementation is able to access the properties directly on the proxy
Well, for Discord NewTitle
, NewIcon
, NewAttentionIcon
, NewIconThemePath
and NewStatus
properties are missing from item_proxy. I have no idea how to make use of your sni_properties
. :/
Ah, yeah you'll have to tell me what is needed. I looked at the interaction between waybar and discord, and this seems to be the behavior when the icon updates (when first started, it's the simple icon, but I have unread messages, so once it logs me in the icon changes, and this is the beginning of that sequence)
Here, :1.47
is waybar, :1.917
is discord. I'll add comments with a #
# discord sends a dbus signal to listeners that its properties has changed
signal time=1705549945.844904 sender=:1.917 -> destination=(null destination) serial=21 path=/StatusNotifierItem; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.kde.StatusNotifierItem"
array [
]
array [
# Icon has changed
string "IconPixmap"
]
# Discord signals to listeners about NewIcon
signal time=1705549945.844916 sender=:1.917 -> destination=(null destination) serial=22 path=/StatusNotifierItem; interface=org.kde.StatusNotifierItem; member=NewIcon
# Waybar presumably detects the signal, and invokes GetAll to get the new properties
method call time=1705549945.855221 sender=:1.47 -> destination=:1.917 serial=10920 path=/StatusNotifierItem; interface=org.freedesktop.DBus.Properties; member=GetAll
string "org.kde.StatusNotifierItem"
method call time=1705549945.855231 sender=:1.47 -> destination=:1.917 serial=10921 path=/StatusNotifierItem; interface=org.freedesktop.DBus.Properties; member=GetAll
string "org.kde.StatusNotifierItem"
method call time=1705549945.855241 sender=:1.47 -> destination=:1.917 serial=10922 path=/StatusNotifierItem; interface=org.freedesktop.DBus.Properties; member=GetAll
string "org.kde.StatusNotifierItem"
method return time=1705549945.855372 sender=:1.917 -> destination=:1.47 serial=23 reply_serial=10920
# <The same properties of sni_proxy from the python block are returned>
I would imagine that it works similarly for the other properties, but I can look into it more if it turns out that's not the case. Is this information pertinent to your concerns?
Side note, python syntax highlighting worked surprisingly well for that code block
Ah, yeah you'll have to tell me what is needed.
Wish I knew. I not the author of this module.
Ah darn. Well I might get around to hacking at it more eventually. For anyone that's interested reading this, I believe this might be the solution:
I think we need to use GLibClient.subscribe_signal
as defined here. We have most of the args, not sure what connection
is but presumably that'd be pretty easy to get. Flags might be tricky if needed. But other than that, we should be able to use that in lieu of the current implementation of detecting property changes
Thanks in advance if you'd like to devote your time to this.
Just wanted to chime in to show my support for this feature being added/improved. The project as a whole seems to be amazing, would love to move to using it over waybar. The issue is that not seeing half of my apps on the tray bar simply makes it unusable for me as apps like Feishin can only be brought back using the tray.
I did look at the code but it's sadly beyond my abilities and willingness to get familiar with the codebase.
I looked at it for another electron application (mullvad-vpn) and it is missing the introspection data. dasbus relies on that to create the properties. One option would be to manually read the properties using .GetAll
with the correct interface or add the interface definition using some internal dasbus knowlege:
_SNI_XML = """
## contents of https://github.com/Alexays/Waybar/blob/26329b660af3169b9daad533017964f35ba98726/protocol/dbus-status-notifier-item.xml
"""
def item_available_handler(self, _observer):
self.item_proxy = self.session_bus.get_proxy(self.service_name, self.object_path)
try:
spec = self.item_proxy._handler.specification
if spec is not None:
if not any("StatusNotifierItem" in ifname for ifname in spec.interfaces):
DBusSpecificationParser._parse_xml(spec, _SNI_XML)
except:
pass
if hasattr(self.item_proxy, "PropertiesChanged"):
...
PRs welcome :)
@nwg-piotr Any plan on tagging a new release including the fix? If not, I can backport the fix in the current Arch package.
Sure, could be done in a minute, if you want.
Sure, could be done in a minute, if you want.
I mean, it's up to you. Either way I can include the fix in the Arch package :) But if you're fine tagging a new release, then let's do it I guess :D
Ready.
Thanks!
just wanted to confirm that this fixes two problematic system tray apps for me (discord and heroic game launcher), really appreciate the work that went into this ticket, y'all. :sparkling_heart:
Describe the bug The Discord tray icon stopped showing on my system after a system update, while others still work. I mainly use the Discord flatpak, but I tried installing the discord AUR package, as well as the Webcord flatpak, and all of them have the same issue.
journalctl
shows an error as follows:To Reproduce Steps to reproduce the behavior:
Expected behavior All system tray icons should work.
Screenshots N/A
Desktop (please complete the following information):
Additional context My suspicions is that it might have something to do with Arch updating to Python 3.11 from 3.10, where AUR packages that depends on Python break, and which before that the Discord tray icon still worked. I've rebuilt all my AUR packages that use Python (including python-dasbus) and all other system tray icons work from what I've tested so far, so I'm not sure why Discord specifically is having problems.