Skip to content

Flatpak: tray and notification icons are not exported, so a Flatpak-only host can't draw them #347

Backlog

Description

@fernando2393

While testing #342 in the Flatpak on GNOME, I noticed that most of tether's icons never leave the sandbox. Flatpak only exports icons named after the app id. rename-icon: tether covers the base tether icon (and tether-symbolic), and the builder skips everything else ("non-allowed export filename"):

  • Tray: tether-offline, tether-unread (all PNG sizes plus the -symbolic SVGs)
  • Notifications: all 15 bundled tether-app-* icons (instagram, whatsapp, discord, …)

Both the tray and the popups hand the desktop an icon name, which the host resolves from its own theme:

  • Tray: the SNI IconName is tether, tether-offline or tether-unread (tray.cpp:576). Inside the Flatpak, tether itself no longer exists either, since it was renamed to io.github.zackb.tether. Because tether-symbolic is also gone, the symbolic check at tray.cpp:170 fails and the tray falls back to the colour icons.
  • Notifications: resolve_icon() checks the candidates against the sandbox's icon dirs, so tether-app-instagram passes. The name then goes to the host notification server, which doesn't have it.

So on a machine with only the Flatpak installed, the tray icon and the app icons on popups should come out blank or generic. I didn't spot it at first because my machine also has the native package, which puts the same names in /usr/share/icons. The evidence is the build log and the sandbox contents (files/share/icons/hicolor/48x48/apps holds io.github.zackb.tether.png, tether-offline.png, tether-unread.png, and the export dir only the first). I haven't checked it on a clean Flatpak-only machine yet.

Possible fixes:

  1. Host-visible paths: when sandboxed, read app-path from /.flatpak-info and send absolute file paths: the icon file path for notifications, and IconThemePath on the SNI item for the tray. This is the smallest change, with no renames.
  2. Prefixed names: install the extra icons with app id prefixes (io.github.zackb.tether.offline, io.github.zackb.tether.app-instagram, …), so Flatpak exports them, and pick the names by flatpak_app_id().
  3. Pixels: send the image data itself (the image-data hint, the SNI IconPixmap). It works everywhere, but it's the most code.

I'd go with 1. Happy to send a PR for whichever you prefer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions