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:

apps:
  screencloud:
    command: desktop-launch screencloud.sh
    desktop: usr/share/applications/screencloud.desktop
    plugs: 
      - 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

parts:
  screencloud:
    source: https://github.com/olav-st/screencloud.git
    source-tag: master
    plugin: cmake
    configflags:
      - -DCMAKE_BUILD_TYPE=Release
      - -DCMAKE_INSTALL_PREFIX=/usr
    build-packages:
      - g++
      - qtbase5-private-dev
      - libqt5svg5-dev
      - libqt5x11extras5-dev
      - qtmultimedia5-dev
      - qttools5-dev
      - python3-dev
    stage-packages:
      - 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!

1 Like

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

2 Likes

Strange, but that works! Thanks!

1 Like