No Tray Icon with Qt Application

The tray icon for my application is not shown. Same application build locally or using AppImage shows the tray icon under Ubuntu 18.04.

I came across this topic System tray icon only works in devmode (Qt 5) but for me it dosn’t even work in devmode and I’ve tried using the mentioned plugin, didn’t work.

apps:
  ksnip:
    command: ksnip
    common-id: ksnip
    desktop: share/applications/ksnip.desktop
    extensions: [kde-neon]
    plugs:
      - home
      - removable-media
      - unity7

parts:
  ksnip:
    source: .
    plugin: cmake
    parse-info: [share/metainfo/ksnip.appdata.xml]
    after:
      - kimageannotator
    build-snaps:
      - kde-frameworks-5-core18-sdk
    build-packages:
      - libglvnd-dev
      - libx11-dev
    configflags:
      - -DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-core18-sdk/current;/snap/kimageannotator/current
    override-pull: |
      snapcraftctl pull
      sed -i 's|Icon=.*|Icon=share/pixmaps/ksnip.svg|g' desktop/ksnip.desktop
      snapcraftctl set-version $(cat CMakeLists.txt | grep project\(ksnip | cut -d" " -f5 | cut -d")" -f1)
  kimageannotator:
    source: https://github.com/ksnip/kImageAnnotator.git
    plugin: cmake
    after:
      - kcolorpicker
    configflags:
      - -DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-core18-sdk/current;/snap/kcolorpicker/current
  kcolorpicker:
    source: https://github.com/ksnip/kColorPicker.git
    plugin: cmake
    configflags:
      - -DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-core18-sdk/current

Any idea what could be missing?

Anyone? Any idea what else could be tried or am I including unity7 incorrectly?

Hi! In Ubuntu Mate I can see the appindicator properly.
In what system are you running the snap?

Ubuntu 18.04.3 with Unity.

Strange… I think it should work on Unity without any isses…
Are there any specific issues when launching from a terminal?
Or one test could be to install (via snap) snappy-debug.
Then you can run that in a terminal, and run ksnip normally.
This should show some issues. Many are unrelated to the indicator, but it might give an idea.
I’m looking at it now as well, I’ll let you know if I find anything

Thanks, I will check it out tonight.

You’re right, I’m not seeing the indicator but the older status icon…
Adding unity7 should have fixed it though…

You’re seeing the tray icon with unity7 set like I have it above in my code snippet?

Yes, but that’s not the right kind of icon…
I’m seeing the tray icon, not the indicator icon.

@damir I was actually wrong, with the unity7 plug I see the proper indicator, but it doesn’t load the icon

Whats the indicator and whats the difference to the tray icon? On the tray icon we have for ksnip a menu where you can create new screenshot or quit the application, stuff like that.

Same thing, the tray icon is the “older” version that doesn’t integrate with the system.
It should work without any change in your code…
(status icon might not be the right name for it…)

I opened a PR with the fix.
The environment needed to be set to Unity7.
It needs to be tested on KDE to see what happens there, but it fixes the issue in gtk environments

PR accepted. I’ll try to test under KDE.