System tray icon only works in devmode (Qt 5)

Hi all,

I’m trying to make a snap for ScreenCloud, but I’ve run into an issue with confinement. The snap works perfectly in devmode, but when I try to install it normally, the tray icon doesn’t work. It seems like QSystemTrayIcon::isSystemTrayAvailable() always returns false. I’ve looked at other Qt 5 apps that have tray icons and they don’t seem to do anything special to make it work in their snaps. Any ideas why it dosen’t work in my case?

The relevant parts of my snapcraft.yaml is:

    command: desktop-launch
    desktop: usr/share/applications/screencloud.desktop
      - x11
      - wayland
      - network
      - home
      - opengl
      - pulseaudio
      - desktop
      - gsettings
      - network-bind #A local port is used to check if another screencloud process is running 
      - network-manager #To get proxy settings

    source-tag: master
    plugin: cmake
      - -DCMAKE_BUILD_TYPE=Release
      - g++
      - qtbase5-private-dev
      - libqt5svg5-dev
      - libqt5x11extras5-dev
      - qtmultimedia5-dev
      - qttools5-dev
      - python3-dev
      - openssl
      - libqt5concurrent5
      - libqt5x11extras5
      - libqt5multimedia5
      - libqt5multimedia5-plugins
      - libglib2.0-bin
      - libpython3-stdlib
      - python3-crypto # For the SFTP plugin
      - python3-cryptography # For the SFTP plugin
    override-build: |
      snapcraftctl build
      sed -i 's|Icon=screencloud|Icon=${SNAP}/usr/share/icons/hicolor/scalable/apps/screencloud.svg|g' $SNAPCRAFT_PART_INSTALL/usr/share/applications/screencloud.desktop
    after: [desktop-qt5, quazip, pythonqt]

Thanks in advance for any help!

You might need to add the unity7 interface to the plugs:

1 Like

Strange, but that works! Thanks!

1 Like