flathub / org.gnu.emacs

https://flathub.org/apps/details/org.gnu.emacs
15 stars 17 forks source link

Run flatpaked emacs in the background #55

Open ivanov17 opened 1 year ago

ivanov17 commented 1 year ago

I think there should be a way to run flatpaked emacs in the background and use emacsclient to connect.

On modern distributions, the traditional way is to create a systemd service, enable it for user and run the application on session startup, see https://www.emacswiki.org/emacs/EmacsAsDaemon. Then just add emacsclient that creates a new frame to autostart, create emacsclient.desktop file and open each file in the same frame.

Flatpak now allows to run applications in the backgound and use autostart, see https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Background.

In my opinion, using just one frame with emacsclient provides better user experience than using a newly-created frame for each buffer. Since flatpaked emacs is used in desktop environments, I think this way should be available or even take precedence.

As I see it, org.gnu.emacs.client.desktop file should definitely be provided by the package. Also there is need to investigate how configure the package to run emacs in the background. The corresponding instruction should be added to emacs-first-run.txt.

jsagfr commented 1 year ago

It' seems possible to start Emacs daemon from flatpak with: flatpak run org.gnu.emacs --daemon

and to run emacsclient from flatpak with: flatpak run --command=emacsclient org.gnu.emacs -c -a emacs