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

Missing tray icon in GNOME #2156

Closed
mbiebl opened this issue Oct 12, 2023 · 28 comments · Fixed by #2177
Closed

Missing tray icon in GNOME #2156

mbiebl opened this issue Oct 12, 2023 · 28 comments · Fixed by #2177

Comments

@mbiebl
Copy link

mbiebl commented Oct 12, 2023

I'm running GNOME and I use the appindicator extension.
System is a Debian unstable installation with solaar version 1.1.10

image

As you can see, no proper icon is displayed for soolar in the system tray and in the journal I see the following warning

Okt 10 14:54:08 pluto ubuntu-appindicators@ubuntu.com[2156]: indicator-solaar, Impossible to lookup icon for 'battery-good' in /usr/share/solaar/icons
@mbiebl mbiebl added the bug label Oct 12, 2023
@pfps
Copy link
Collaborator

pfps commented Oct 12, 2023

Solaar is a GTK application and gets most of its icons using the normal GTK interface. If the icons are not available using this interface then Solaar cannot find them. The solution to this problem is to install the GTK icons in the right place using whatever means for this is provided by your distribution.

@pfps pfps removed the bug label Oct 12, 2023
@mbiebl
Copy link
Author

mbiebl commented Oct 12, 2023

$ find /usr/share/icons/ -name battery-good*
/usr/share/icons/gnome/22x22/status/battery-good.png
/usr/share/icons/gnome/22x22/status/battery-good-charging.png
/usr/share/icons/gnome/32x32/status/battery-good.png
/usr/share/icons/gnome/32x32/status/battery-good-charging.png
/usr/share/icons/gnome/48x48/status/battery-good.png
/usr/share/icons/gnome/48x48/status/battery-good-charging.png
/usr/share/icons/gnome/16x16/status/battery-good.png
/usr/share/icons/gnome/16x16/status/battery-good-charging.png
/usr/share/icons/gnome/256x256/status/battery-good.png
/usr/share/icons/gnome/256x256/status/battery-good-charging.png
/usr/share/icons/gnome/24x24/status/battery-good.png
/usr/share/icons/gnome/24x24/status/battery-good-charging.png
/usr/share/icons/breeze-dark/status/16/battery-good-charging.svg
/usr/share/icons/breeze-dark/status/16/battery-good.svg
/usr/share/icons/breeze-dark/status/22/battery-good-charging.svg
/usr/share/icons/breeze-dark/status/22/battery-good.svg
/usr/share/icons/breeze-dark/status/symbolic/battery-good-charging-symbolic.svg
/usr/share/icons/breeze-dark/status/symbolic/battery-good-symbolic.svg
/usr/share/icons/breeze-dark/status/32/battery-good-charging.svg
/usr/share/icons/breeze-dark/status/32/battery-good.svg
/usr/share/icons/breeze/status/16/battery-good-charging.svg
/usr/share/icons/breeze/status/16/battery-good.svg
/usr/share/icons/breeze/status/22/battery-good-charging.svg
/usr/share/icons/breeze/status/22/battery-good.svg
/usr/share/icons/breeze/status/symbolic/battery-good-charging-symbolic.svg
/usr/share/icons/breeze/status/symbolic/battery-good-symbolic.svg
/usr/share/icons/breeze/status/32/battery-good-charging.svg
/usr/share/icons/breeze/status/32/battery-good.svg
/usr/share/icons/HighContrast/22x22/status/battery-good.png
/usr/share/icons/HighContrast/22x22/status/battery-good-charging.png
/usr/share/icons/HighContrast/32x32/status/battery-good.png
/usr/share/icons/HighContrast/32x32/status/battery-good-charging.png
/usr/share/icons/HighContrast/48x48/status/battery-good.png
/usr/share/icons/HighContrast/48x48/status/battery-good-charging.png
/usr/share/icons/HighContrast/16x16/status/battery-good.png
/usr/share/icons/HighContrast/16x16/status/battery-good-charging.png
/usr/share/icons/HighContrast/256x256/status/battery-good.png
/usr/share/icons/HighContrast/256x256/status/battery-good-charging.png
/usr/share/icons/HighContrast/24x24/status/battery-good.png
/usr/share/icons/HighContrast/24x24/status/battery-good-charging.png
/usr/share/icons/Adwaita/symbolic/legacy/battery-good-charging-symbolic.svg
/usr/share/icons/Adwaita/symbolic/legacy/battery-good-symbolic.svg

Anything missing here?

@pfps
Copy link
Collaborator

pfps commented Oct 12, 2023

This depends on where GTK on your system expects to find icons. It also depends on what resolution is being used and what fall-back method are being by GTK.

@bfcns
Copy link

bfcns commented Oct 19, 2023

Installing libappindicator-gtk3 got the icon back in arch kde. Maybe adding it as a dependency would help?

@pfps
Copy link
Collaborator

pfps commented Oct 19, 2023

Sounds reasonable. The suggestion is already in docs/installation.md

The precise package to install may depend on the Linux distribution so this is something for packagers to consider.

@mbiebl
Copy link
Author

mbiebl commented Oct 20, 2023

I don't think that's the issue here. Afaics, I have all the necessary libraries installed.

Immediately after I'm logged in, I do get an icon like this displayed:
image
But once the system runs for a while, it eventually ends up showing #2156 (comment)

So my guess is, that there is some kind of battery event which triggers an icon update, which subsequently fails
Which would explain the log message I'm seeing

@pfps
Copy link
Collaborator

pfps commented Oct 20, 2023

If battery icons show up in the Solaar main window then the problem is not missing or incorrect installation of icons but is instead a problem with the system tray. If battery icons do not show up in the Solaar main window then the likely cause is missing or incorrect installation of icons. Running Solaar as solaar -ddd should then provide more information on what might be going on.

@pfps
Copy link
Collaborator

pfps commented Nov 4, 2023

Is there anything more to be done here?

@mbiebl
Copy link
Author

mbiebl commented Nov 4, 2023

Well, I do have the equivalent of libappindicator-gtk3 installed on Debian, I do have proper icon themes installed, but the problem persists.
I can't rule out it's a systray/appindicator problem, i'm using https://extensions.gnome.org/extension/615/appindicator-support/ fwiw.
That said, solaar is the first app where I've seen this problem.

@pfps
Copy link
Collaborator

pfps commented Nov 4, 2023

The issue appears to be that ubuntu-appindicator can't find the battery-good icon, which is should be available to it. So Solaar is doing the right thing. As I don't run ubuntu I don't have much expertise in fixing the problem.

@mbiebl
Copy link
Author

mbiebl commented Nov 4, 2023

@pfps my guess is, that this issue happens whenever there is a battery event. Is there a way to force/trigger such an event manually so we can further debug this?

@mbiebl
Copy link
Author

mbiebl commented Nov 4, 2023

Maybe related ubuntu/gnome-shell-extension-appindicator#283

@pfps
Copy link
Collaborator

pfps commented Nov 4, 2023

You can force an icon change by turning off all devices or unplugging the receiver. But whether appindicator will produce messages is unknown.

@pfps
Copy link
Collaborator

pfps commented Nov 16, 2023

Is this still a problem?

@mbiebl
Copy link
Author

mbiebl commented Nov 16, 2023

It is, yes.

@mbiebl
Copy link
Author

mbiebl commented Nov 17, 2023

I changed the following. After that solaar worked properly:

diff --git a/lib/solaar/ui/tray.py b/lib/solaar/ui/tray.py
index 8e04dc4..e29a635 100644
--- a/lib/solaar/ui/tray.py
+++ b/lib/solaar/ui/tray.py
@@ -177,10 +177,9 @@ try:
 
     def _create(menu):
         _icons._init_icon_paths()
-        theme_paths = Gtk.IconTheme.get_default().get_search_path()
 
-        ind = AppIndicator3.Indicator.new_with_path(
-            'indicator-solaar', _icon_file(_icons.TRAY_INIT), AppIndicator3.IndicatorCategory.HARDWARE, theme_paths[0]
+        ind = AppIndicator3.Indicator.new(
+            'indicator-solaar', _icon_file(_icons.TRAY_INIT), AppIndicator3.IndicatorCategory.HARDWARE
         )
         ind.set_title(NAME)
         ind.set_status(AppIndicator3.IndicatorStatus.ACTIVE)

Something computing the theme path is broken apparently, so I relied on the default.

It now looks like this

Bildschirmaufzeichnung.vom.2023-11-17.02-01-51.mp4

@mbiebl
Copy link
Author

mbiebl commented Nov 17, 2023

I dumped theme_paths[0]

2023-11-17 02:09:02,886,886    DEBUG [MainThread] solaar.ui.tray: theme path: /usr/share/solaar/icons

It's now obvious why this is broken under the AppIndicator

@mbiebl
Copy link
Author

mbiebl commented Nov 17, 2023

This now also explains the error message I posted in my initial report:

Okt 10 14:54:08 pluto ubuntu-appindicators@ubuntu.com[2156]: indicator-solaar, Impossible to lookup icon for 'battery-good' in /usr/share/solaar/icons

mbiebl added a commit to mbiebl/Solaar that referenced this issue Nov 17, 2023
Using /usr/share/solaar/icons as theme path will break the lookup of the
icons within the AppIndicator based tray, resulting in:

Okt 10 14:54:08 pluto ubuntu-appindicators@ubuntu.com[2156]: indicator-solaar, Impossible to lookup icon for 'battery-good' in /usr/share/solaar/icons

Fix that by using the default theme path.

Fixes: pwr-Solaar#2156
mbiebl added a commit to mbiebl/Solaar that referenced this issue Nov 17, 2023
Using /usr/share/solaar/icons as theme path will break the lookup of the
icons within the AppIndicator based tray, resulting in:
```
Okt 10 14:54:08 pluto ubuntu-appindicators@ubuntu.com[2156]: indicator-solaar, Impossible to lookup icon for 'battery-good' in /usr/share/solaar/icons
```
Fix that by using the default theme path.

Fixes: pwr-Solaar#2156
mbiebl added a commit to mbiebl/Solaar that referenced this issue Nov 17, 2023
Using /usr/share/solaar/icons as theme path will break the lookup of the
icons within the AppIndicator based tray, resulting in:
```
Okt 10 14:54:08 pluto ubuntu-appindicators@ubuntu.com[2156]: indicator-solaar, Impossible to lookup icon for 'battery-good' in /usr/share/solaar/icons
```
Fix that by using the default theme path.

Fixes: pwr-Solaar#2156
@mbiebl
Copy link
Author

mbiebl commented Nov 17, 2023

This was broken in #1129

@pfps
Copy link
Collaborator

pfps commented Nov 17, 2023

Hmm. That change was, I think, to fix a problem with some implementations of appindicator. I'll take a closer look.

@pfps
Copy link
Collaborator

pfps commented Nov 17, 2023

The appindicator on my system uses this path as an addition to the paths it normally searches. I guess some other systems work differently. But appindicator needs to know where to pick up the Solaar icons. Did you move the Solaar icons to a standard place?

@mbiebl
Copy link
Author

mbiebl commented Nov 17, 2023

Which "other" appindicator? Does it not use the reference implementation from libappinidcator?
As for the icon:

setup.py:    yield 'share/icons/hicolor/scalable/apps', ['share/solaar/icons/solaar.svg']
$ dpkg -L solaar | grep solaar.svg
/usr/share/icons/hicolor/scalable/apps/solaar.svg
/usr/share/solaar/icons/solaar.svg

@pfps
Copy link
Collaborator

pfps commented Nov 17, 2023

The appindicator on my system uses this path as an addition to the paths it normally searches. I guess some other systems work differently. It appears that the appindicator on my system can find the Solaar icon even without adding the path and even after I scrub all the Solaar icons from the normal places. So it appears that your change will work correctly.

@rathann What is a good way to try out this change on a system that has Solaar installed only via an rpm package?

@rathann
Copy link
Contributor

rathann commented Nov 17, 2023

@rathann What is a good way to try out this change on a system that has Solaar installed only via an rpm package?

@pfps I often tested Solaar running it straight from a local git repo clone. Just stop the one you have already running and run it from local source.

@pfps
Copy link
Collaborator

pfps commented Nov 17, 2023

@Rathaan The problem that is being addressed here is accessing the Solaar custom icons. There is code in Solaar to try to find these icons in various places. What I need to do is to see whether a simplification of the code will work if Solaar is installed from an rpm package. If you send me the script you use to create the package I should be able to create a package on my machine and install it locally.

@pfps
Copy link
Collaborator

pfps commented Nov 17, 2023

@mbiebl Solaar has considerable code to try and find where its icons are stored. I think this was put in in the past when finding themed icons was not so sophisticated. I'm going to remove this code and depend on Solaar finding icons in the normal way plus having the Solaar custom icons put a place where they should be found in the normal way. I think I have this working but need to check out whether it also works when Solaar is packaged and installed from the package.

@mbiebl
Copy link
Author

mbiebl commented Nov 17, 2023

I'm going to remove this code and depend on Solaar finding icons in the normal way plus having the Solaar custom icons put a place where they should be found in the normal way. I think I have this working but need to check out whether it also works when Solaar is packaged and installed from the package.

I think this is a good idea, thanks.

If you want me to test something, let me know.
I guess you have enough information now to take it from here?
I'll leave it up to you to evaluate whether #2176 is sufficient or not.
I did test it with a classic systray and two different AppIndicator implementations.

@pfps
Copy link
Collaborator

pfps commented Nov 17, 2023

PR #2177 updates the handling of icons. It includes your change but also installs icons better and removes some code in Solaar that tries to find icons in places other than where GTK expects them. Please try it out.

You will have to download PR #2177 and try it out in several ways. First just try running bin/solaar and see whether all the icons show up correctly. Second, use pip install . to install Solaar for yourself and then run Solaar from ~/.local/bin/solaar. Check whether the correct icons show up in both the Solaar windows and the system tray.

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