custom GUI app in GNOME, desktop file & app menu

2

I made a custom QML app and a .desktop file for it:

[Desktop Entry]
Comment=
Terminal=false
Name=ProjectPad
Exec=/home/emmanuel/home/projectpad/.cabal-sandbox/bin/projectpad
Type=Application
Icon=emblem-documents-symbolic.symbolic

The desktop file works, I can start the app, however once started in gnome-shell in the app menu and in alt-tab it shows only Unknown and a missing icon. The icon is properly displayed in gnome-system-monitor though. I understand that gnome expects the application to register its name a startup using Gtk APIs, however I can't easily do that from a QML app. How can I achieve that gnome will take into account the app name & icon from the desktop file not only at launch time but also later, in alt-tab & app menu?

EDIT: I think it might be a problem with the binding to QML that I'm using from Haskell, I've opened a bug there. But it's only a theory... The fact is that according to xprop, there is no WM_CLASS (not found) nor WM_Class (so such atom on any window). I think QML and the HSQML library that I use should ensure that WM_CLASS is populated and they don't, that's why I don't get an icon I believe.

Emmanuel Touzery

Posted 2015-06-07T15:14:07.893

Reputation: 377

Have you tried using an icon in your home folder (absolute path under .local/share/icons or .icons)? – Ludenticus – 2015-06-10T01:29:49.070

the current symbolic icon works in the launcher menu. doesn't work (as with the app name) later once it's launched. I would think it's not related, but i'll try this tonight and report. – Emmanuel Touzery – 2015-06-10T08:00:48.170

Right, I just tried, but to put a real icon name, absolute path under my home dir, that didn't help. Also a real icon name which is not a symbolic icon... didn't help. – Emmanuel Touzery – 2015-06-10T17:51:07.690

Maybe it is the same problem one faces to crea a java desktop icon: it is needed to add the StartupWMClass – Ludenticus – 2015-06-11T04:58:30.140

I think yes. The bug I opened is related to the fact that the app doesn't set a WM_CLASS X11 property. I don't think I can control it from my code, it should probably be set up from the library. – Emmanuel Touzery – 2015-06-11T07:20:56.290

You can add it with the (second) result of xprop WM_CLASS. Does it help? – Ludenticus – 2015-06-11T17:13:58.527

are you saying I can use xprop to SET an X11 property? I tried a bit now and failed. It says unsupported conversion. Otherwise I see others apps even have their icons in X11 properties, in _NET_WM_ICON... Interesting... – Emmanuel Touzery – 2015-06-11T18:18:04.690

No. I meant to type xprop WM_Class and then point to the QML app. You add that information to the .desktop file (which I guess resides in .local/share/applications or your root folder) thus: StartupWMClass=name-of-the-app-according-to-xprop. Remember to restart the icon theme – Ludenticus – 2015-06-11T18:39:40.993

xprop WM_Class will render two names. Use the second one – Ludenticus – 2015-06-11T19:00:18.760

Yes but I think the root problem is that the app does not export any such X11 property (I updated the question now). xprop WM_Class returns WM_Class: no such atom on any window. and xprop WM_CLASS returns WM_CLASS: not found.. So I can't add this property. – Emmanuel Touzery – 2015-06-11T20:23:45.350

No answers