Thank! Yes indeed, until now I only tested starting from command line only.
The permanent solution works for Signal too. Because it’s a snap I had to copy the desktop file from
cp /var/lib/snapd/desktop/applications/signal-desktop_signal-desktop.desktop ~/.local/share/applications/
Then, because I am not familiar with sed I opened the new desktop file with a text editor and added XDG_CURRENT_DESKTOP=Unity7
to the Exec env setting, it now looks like this:
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/signal-desktop_signal-desktop.desktop XDG_CURRENT_DESKTOP=Unity7 /snap/bin/signal-desktop --no-sandbox %U
Similar for Heroic Games Launcher as a Flatpak install:
cp /var/lib/flatpak/app/com.heroicgameslauncher.hgl/current/active/export/share/applications/com.heroicgameslauncher.hgl.desktop ~/.local/share/applications/
Then added env XDG_CURRENT_DESKTOP=Unity7
to the Exec options, it now looks like this:
Exec=env XDG_CURRENT_DESKTOP=Unity7 /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=heroic-run --file-forwarding com.heroicgameslauncher.hgl @@u %u @@
I also tried adding an icon line. But the tray icon still is “missing image”. The program icons in dash and starter are fine even without the icon path in the desktop file.
The icon could be found here: /var/lib/flatpak/app/com.heroicgameslauncher.hgl/current/active/export/share/icons/hicolor/128x128/apps/com.heroicgameslauncher.hgl.png
For Discord, I copied this:
cp /usr/share/applications/discord.desktop ~/.local/share/applications/
and edited the file with this Exec line:
Exec=env XDG_CURRENT_DESKTOP=Unity7 /usr/share/discord/Discord
But I also had to make the file executable before it would work.
About VirtualBox: I’m sorry, It’s one of those programs where I’ve often missed a tray icon, but I guess it never officially had one.
However, it has the impression on me that this can only be a temporary solution. If a programs desktop starter is changed by updates, maybe with a new icon design or other execution arguments, the changes will be overwritten by my desktop files in ~/.local/share/applications when I run the program and it may not work properly. If uninstalled, I have to remove the files manually.
Anyway, if I come across other programs whose tray icons don’t appear with Unity, I will try this solution.