Bug 371576 - AppIndicator GTK apps fail to find icons in custom GTK icon theme folder and crash
Summary: AppIndicator GTK apps fail to find icons in custom GTK icon theme folder and ...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: System Tray (show other bugs)
Version: 5.8.2
Platform: Arch Linux Linux
: NOR crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-24 13:28 UTC by André Brait
Modified: 2018-03-05 17:40 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
application runnin showing the correct icon (10.32 KB, image/png)
2016-11-07 14:35 UTC, Marco Martin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description André Brait 2016-10-24 13:28:03 UTC
I'm the developer/maintainer of a couple of system tray AppIndicator-based apps and users running KDE Neon reported my apps wouldn't work on their computers.

I happen to run Arch now and I noticed they wouldn't work in my computer too. But they do work ok in Kubuntu when using both the shipped KDE 5.5 and the 5.6 from the backports. Since KDE Neon is basically Kubuntu 16.04 running KDE 5.8.2 and I'm running 5.8.2 in Arch as well, I think there's something that changed between these releases that made my applications stop working. It would still work in other DE's as well, such as Unity, XFCE, LXDE and MATE.

What I know:
- KDE 5.8 now demands custom icon folders have their names ended in "icons". 
A user provided me with this error when starting the application with the old folder names:

kde.systemtray: Wrong IconThemePath "/home/john/.config/prime-indicator/icons-symbolic" : too short or does not end with 'icons'

I changed it to conform to this requirement and it still didn't work (see below).

- My Apps used a custom GTK Icon theme folder with some icons there. I would then set the icon using only the name of the file. This allowed people with icon themes that provided icons for my applications to use the icons from their themes by default, fallbacking to my icons if there was none in their current themes. When using icons from the folder, they'd get (by restarting plasmashell):

Registering ":1.134/org/ayatana/NotificationItem/PRIME_Indicator"
QQuickItem::stackAfter: Cannot stack after 0x5cf9b80, which must be a sibling

- The solution was to explicitly set the icons using the path to the filles themselves. I circumvented the problem this would cause (the user not being able to use their theme's icons) by explicitly getting the current icon theme inside the application, requesting the icon for the application and, if it existed, setting the application icon using the full path of the file provided by the theme, only using my icons if no icons were provided by the theme, again setting the icons using the full path to my icon files.

- The issue and the commit needed to fix this issue can be found here: https://github.com/andrebrait/prime-indicator/issues/7

I'm concerned this will end up breaking quite a few applications based on AppIndicator and this breaks some functionality which is expected from an AppIndicator application. The whole point of being able to set custom icon theme folders is to allow the GTK theming machanism do the lookup for you and choose which icon should be displayed.

Reproducible: Always

Steps to Reproduce:
1. Have a NVIDIA Optimus enabled laptop hanging around
2. Go to http://github.com/andrebrait/prime-indicator and download the sources to version 1.0.0.
3. Use the setup script to install the application in KDE Neon
4. Try to run the application.
5. See the command line output.

Alternatively

1. Create any AppIndicator application, setting the icon to some name.
2. Create a new AppIndicator instance setting the icon theme folder path. 
3. Place some icons in the folder, including one for the name you set in step 1.
4. Start your application and the icon won't show.

Actual Results:  
Icon will not be shown and the app will crash.

Expected Results:  
Icon should be shown, just like it used to in KDE < 5.8.
Comment 1 David Edmundson 2016-10-24 13:58:26 UTC
>- KDE 5.8 now demands custom icon folders have their names ended in "icons". 

It always had. 
The path should match a valid icon directory as specified in 
https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

i.e yourpath/icons/hi-color/48x48/blah.png

you would have been getting this warning before, just maybe silently working.


Though we shouldn't have changed behaviour in minor releases
Comment 2 André Brait 2016-10-24 14:03:21 UTC
(In reply to David Edmundson from comment #1)
> >- KDE 5.8 now demands custom icon folders have their names ended in "icons". 
> 
> It always had. 
> The path should match a valid icon directory as specified in 
> https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
> 
> i.e yourpath/icons/hi-color/48x48/blah.png
> 
> you would have been getting this warning before, just maybe silently working.
> 
> 
> Though we shouldn't have changed behaviour in minor releases

Oh, my bad then. Yeah, it used to work ok, but I don't recall getting the warning. It still works in other DE's, I think they don't check this stuff. Enforcing correctness is ok.

The change was apparently somewhere between 5.6 and 5.8. Are these considered to be minor releases?
Comment 3 Marco Martin 2016-11-03 15:47:59 UTC
do you have an application that can reproduce the problem that doesn't require any particular hardware?
Comment 4 André Brait 2016-11-03 21:45:06 UTC
(In reply to Marco Martin from comment #3)
> do you have an application that can reproduce the problem that doesn't
> require any particular hardware?

I have modified one of mine to behave like it used to when using the default options, and also to not depend on any specific hardware:

https://github.com/andrebrait/nvidia-power-indicator-fake

If you change the icon option to 'color', however, it sets the full icon to the icon file and it works ok.

It seems that it now appears, but no icon is displayed. I can't get the same message as the user got, but I'm on Arch Linux, so many things have changed between when this bug was reported and now. At the time, the user was running KDE Neon.

Please let me know if I can be of any help.
Comment 5 André Brait 2016-11-03 21:46:04 UTC
Full >>>path<<< to the icon file, sorry for the typo.
Comment 6 Marco Martin 2016-11-07 14:35:18 UTC
Created attachment 102104 [details]
application runnin showing the correct icon

Thanks.
I tried your application on master, but seems to work fine.
It starts good, the nvidia icon is shown, if i click "force nvidia off" the icon gets replaced by the intel logo as expected.
On distro packages (5.8.0) no crash happens, but the icon is broken
so would need a bit of testing to make sure it's really ok in master and current 5.8 branch
Comment 7 Alexander Mentyu 2018-02-26 16:31:47 UTC
The app icons are looking ok in:

Plasma: 5.12.2
Apps: 17.12.2
Frameworks: 5.43.0
Qt: 5.10.1
Kernel: 4.14.20-2-MANJARO
OS: Netrunner Rolling
fcitx-4.2.9.6-1
Comment 8 David Edmundson 2018-03-05 17:40:07 UTC
Only open part of this bug was about 5.8, and that's not getting any changes for this.