Hi. I am trying to create a service to automatically open Emacs to the desktop on user login. I have tried two main methods.
Systsemd Service using home-manager
systemd.user = {
startServices = "sd-switch";
services = {
emacs.service = {
enable = true;
script = ''emacs -fs &'';
wantedBy = [ "graphical-session.target" ];
};
};
};
Full home-manager file
This doesn’t seem to do anything. I tested it by replacing emacs -fs &
with touch ~/test.txt
and it still didn’t work. So I am assuming I am missing something fundamental to configuring systemd services.
Using the service.emacs
option
services.emacs = {
enable = true;
startWithUserSession = "graphical";
extraOptions = [
"-fs"
];
};
Full Emacs config file
This “works” but doesn’t do what I was intending it to. Instead opening a server in the background witch doesn’t seem to use my init.el
, and conflicts with any Emacs instance I open normally.
I would prefer to get the systemd service working if possible as that would be a useful way to solve a few other problems I am currently working on. For context I am tryning to start Emacs like this so EXWM can automatically take over as the window manager inside an XFCE display environment.