Then I typed “Telegram” into the Application launcher, and an item called Telegram Desktop (with the Telegram icon) showed up, so I clicked it, but that showed this error:
So, I launched it from a terminal instead, with:
flatpak run org.telegram.desktop &
Note the & at the end. Usually, that means that I can close the terminal and the program I launched keeps running, but not in this case. If I close the terminal, Telegram closes too.
Why is that? Is there a workaround?
Also, any idea why the launcher doesn’t work in the first place?EDIT: that part I figured out, I needed to reboot (no, log out and in is not enough)
Binaries are available in /var/lib/flatpak/exports/bin, which is automatically added to $PATH by /etc/profile.d/flatpak-bindir.sh. You may have to re-login to apply the change.
EDIT: someone else has further edited it. My original title was “Flatpak dies if I close the terminal I launched it from, even with &”; I guess what confused you was the lack of quotes around the “&”, other than that it made perfect sense.
No, that’s a completely different issue, it has nothing to do. It’s funny that you went through all the trouble to google some of the things I mentioned, but did not even read my post.
That wasn’t enough. Reboot did fix the issue. Having to log out and in wouldn’t be an acceptable requirement either. Is that a bug in Flatpak or somewhere in KDE?
Instead of roundabout and tedious things, like seen here:
The /etc/profile.d/flatpak-bindir.sh script updates your PATH for you … but may need to be reinitialized.
Maybe you could run it yourself or do something or other without having to go through poweroff etc. But again, I dont use flatpak, and the docs seem to expect it to act this way.
I’m still curious about the original question: why closing the terminal closes the flatpak app even if the command launching it was executed with the “&” at the end.
Because putting an ampersand behind the command only daemonizes it — i.e. it is being executed as a background job of your shell, and the shell supports multitasking, so the process can still be brought back to the foreground.
Whether running in the foreground or the background, the parent process is still the shell itself, and if you close the terminal window, then you’re killing the parent process.
Whether running in the foreground or the background, the parent process is still the shell itself, and if you close the terminal window, then you’re killing the parent process.
How come it works with most other programs, though?
Interestingly, not everything. For whatever reason, it works with Kate, which is what I quickly tried before posting here. But it seems to be the exception rather than the rule.
Now I’m curious why it works with Kate specifically. Maybe it does something special on startup?