onli / simdock

small dock with pseudo-transparency and good window handling
GNU General Public License v2.0
34 stars 3 forks source link

Settings in the AppImage don't work #7

Closed probonopd closed 4 years ago

probonopd commented 6 years ago

On neon-devedition-gitunstable-20180826-0812-amd64.iso with Simdock-5fc553b-x86_64.AppImage I get this error. Is it searching another hardcoded path?

onli commented 6 years ago

Can you give some more context for this issue? Does that happen after a specific interaction? Just opening the settings is enough?

probonopd commented 6 years ago

Right-click -> Settings. Then this appears.

onli commented 6 years ago

I fixed a bug with the background image. There is the very small chance that it might have helped here already.

But I think the problem lies here:

https://github.com/onli/simdock/blob/3aab011e122de731f13e91601888a420420028c0/src/settingsDialog.cc#L73

The settings dialog assumes the system has icons for applications-system, applications-accessories and applications-graphics, and also wxART_INFORMATION which I'd have to look up what it resolves to. I assume one of those is missing. Solution would be to check for that, and then either show a fallback icon or none at all.

probonopd commented 6 years ago

Yes, that's most likely what is going on. You can check with this command:

me@host:~$ sudo strace -f Downloads/Simdock-3aab011-x86_64.AppImage 2>&1 | grep share/icons | grep ENOENT > log.txt

(...)
[pid  8211] stat("/home/me/.local/share/icons/gnome/scalable/stock/chart", 0x7ffde7f0e3d0) = -1 ENOENT (No such file or directory)
[pid  8211] stat("/home/me/.local/share/icons/hicolor/scalable/stock/chart", 0x7ffde7f0e3d0) = -1 ENOENT (No such file or directory)
[pid  8211] stat("/home/me/.local/share/icons/gnome/scalable/stock/code", 0x7ffde7f0e3d0) = -1 ENOENT (No such file or directory)
...
onli commented 4 years ago

I finally got annoyed by this and I think it is solved now. The two commits addressing this are: https://github.com/onli/simdock/commit/814afe4e87bd2028652586520ce72e7cdbdf05b0 and https://github.com/onli/simdock/commit/25c7482a699223d87ee10e4844e235c26ecc652c.

And because the main reason this lingered so long is missing information on the web on how to address missing icon problems like this in wxWidgets, some explanations here:

  1. The first commit tries to to a fallback scheme and to get more icons that might be available. The fallback is creating an icon for the id wxART_INFORMATION and using this if the other icon is not IsOk(). Note that if you want something that really always works you probably have to ship your own icon and load that. The get more icons part is not just doing a wxArtProvider::GetIcon for the target size, but creating an wxArtProvider::GetIconBundle instead and to get an icon from that, with wxIconBundle::FALLBACK_NEAREST_LARGER as parameter. It did not help on my system, but maybe it would somewhere else.
  2. It's completely bonkers that not finding an icon should stop the program, and actually it does not. It soundly just paints the button/tab without an icon. But that strange "An assertion failed" dialogue probonopd showed blocks the user anyway. You can and should disable this dialogue completely by setting #define NDEBUG 1 early in your main. Might be a way to do that in your Makefile and trigger debug and production builds like that, but again that's not documented accessibly anywhere, and I wouldn't want it in the continuous AppImage build in any case.

Note that I also checked which icon did not load, it's the one with the applications-accessories, at least on my system. I have no idea why that one would be missing, it's a valid icon id listed in https://developer.gnome.org/icon-naming-spec/. Granted, it's possible that's not the spec to look at, but it's not like something else comes up when searching.

@probonopd: Thank you for the report!

probonopd commented 4 years ago

I can confirm that the settings are now working in the AppImage :+1: Thanks @onli