Backhground desktop apps and snaps

Okay, so GNOME 44 will now have background apps support, means you can see the background apps running, directly from the gnome-shell. The info is from the post by OMGLinux.

Ubuntu 23.04 Lunar Lobster gonna have GNOME 44 by default. But where does snap stands? Reading the documentation, I found out that to run an app in background, even after quitting it, I can declare it a daemon from the apps section. But it’s only for command line tools and not for graphical apps, as the icon of that app doesn’t shows up in the appmenu.

With anything you try, there will be no icon, even if there is icon, it’ll not run the app. So, is there any plans for allowing graphical apps running in background? Recently I posted about this here, I also know some apps, like Amberol(by @alexmurray) which has the same ability as the app I wrote about, have background-playback. But these can’t be implented in snaps. Even apps like thunderbird, doesn’t have the background running option for snaps. Same case for many other unknown apps. What will be the future then? Will there be no such support?

This not yet finished feature is simply a replacement for the existing systray icons … it will only work on systems that will have the new xdg portal for it shipped in the desktop… so even if you would be able to use it today in your app, 99% of the existing desktops would not yet provide the required framework to you and your app would simply fail to use this feature…

On the snap side this this feature will be available when a gnome 44+ based extension is available to provide the app side of the portal (most likely with 24.04)… but even then the desktop side will have to have the other half of the portal available… so again, your app will not have this feature on KDE, xfce, lxqt, you name it… only on latest gnome installs your snap would fully work…

If you can (and the app allows to switch to it), better use the existing systray implementation… that should make it at least function everywhere…

This is nothing new. I guess I am not able to explain it to you. Let’s take rhythmbox for example. In rhythmbox, we start to listen to a song, and while it’s playing, I close it. Even after that the songs will play on, and will not stop, until I pause the song. Clicking on the song will reopen the rhythmbox again. But, if I snap the rhythmbox app, this behavior can’t be reproduced. As snaps are killed, whenever they are closed. But I was able to make that thing(Continue to play the music even after the app is closed) in a snap. What I did was added the daemon option in my apps part. Like this

apps:
  g4music:
    extensions: [gnome]
    command: usr/bin/g4music
    daemon: simple
    desktop: snap/meta/gui/g4music.desktop
    common-id: com.github.neithern.g4music
    environment:
      GTK_USE_PORTAL: 1
      PIPEWIRE_CONFIG_NAME: $SNAP/usr/share/pipewire/pipewire.conf
      PIPEWIRE_MODULE_DIR: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pipewire-0.3
      HOME: "$SNAP_USER_COMMON"
    slots:
      - mpris
    plugs:
      - home
      - network
      - network-status
      - audio-playback
      - removable-media
      - mount-observe

But, there is only one problem. I have to run the app from the terminal with the snap run g4music command. Because, there was an icon of the app in the desktop, but clicking on it, the app wasn’t starting up. I think with a small changes in the snapd this can be done. And this is the feature I’m talking about, as many snaps lack this option, like mailspring, thunderbird have this option directly or via plugin in their deb version but not in snap version. Kindly consider this thing. This is an example of the rhythmbox behavior I’m talking about.

the thing you pointed to is a brand new re-implementation of the existing systray behavior … i know how it works i have a bunch of snaps (most non-public) that utilize this to play stuff while not visible or keep running while not on screen … these effectively minimize into the systray instead of closing and you need a specific menu entry in the systray context menu or the app menu to actually close them …

one of these apps in the store from me is mattermost-client-ogra … feel free to take a look there …

again, the daemon option in snaps is for system services, it will spawn a server (webserver, database server, you name it) program on boot as root … it is not used/usable in user sessions at all but will create a systemd unity that makes them run as root permanently.

The problem is, these apps (g4music, amberol) doesn’t have a systray indicator, which isn’t abnormal though. For these apps the background play feature isn’t working.

Yes, and as i said two posts ago, it will not work until desktops actually ship the portal for background processing, relying on something like this breaks the “snaps should run everywhere” paradigm… similar to you forcing pipewire in your recent snapcraft.yaml this makes snaps incompatible with the majority of desktops out there…

I am not able to make it work, but that have a feature to enable named experimental pipewire support. But noway to make it work.

As I said before, you will need a gnome 44 extension that does not exist yet… (and even then the desktop will have to have the desktop side of the portal available, else it will not work (i.e. on most desktops it will fail anyway because they will not get the portal for a while))

I just have one last question, if the app is installed as deb, how does it play in background then? What is the mechanism there? Sorry to bother you again and again.

installed as deb where exactly ?

have you installed it on a 16.04 unity desktop, on a 20.04 xfce desktop, on a last-years fedora desktop, on a current (22.04) ubuntu LTS ?

(independent of that, the deb will not use a portal at all … unlike a flatpak or snap)

It’s in my Ubuntu 22.10, it works in any desktop ig. I checked only in Fedora tho, it worked there.

well, it uses an exclusive gnome 44 feature you will only find there …

so i dont get how it would work anywhere else where that feature is not available …