You are not logged in.
Pages: 1
Im attempting to move away from dex and using systemd as an alternative to autostart my apps.
See the recommendation here: https://github.com/jceb/dex
My first attempt wasnt a complete failure, as I can get the daemon to start manually when I issue the command
$ systemctl --user start autostart.targetUnfortunately, I want this to automagically start on boot. If possible I would like to do it without adding another line in rc.lua
my service file is as follows:
[Unit]
Description=Package Update Notifier
After=user@1000.service
[Service]
ExecStart=/bin/bash -c "GDK_BACKEND=x11 pamac-tray"
Restart=alwaysAny thoughts you have is appreciated.
Offline
I want this to automagically start on boot.
I assume you mean when the user logs in as a user service will never run on boot.
But in any case, running X clients as user services is tricky at best - there is some guidance here, but the specifics will depend on how you start X. I gather from the mention of rc.lua that you are using awesomewm - do you start this via xinit/startx? Are these run from a tty, a DM, or as a user service?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I assume you mean when the user logs in as a user service will never run on boot.
Correct.
But in any case, running X clients as user services is tricky at best - there is some guidance here, but the specifics will depend on how you start X. I gather from the mention of rc.lua that you are using awesomewm - do you start this via xinit/startx? Are these run from a tty, a DM, or as a user service?
Admittedly, I haven't read the link you posted yet. Its late, but I promise to read it tomorrow morning.
Yes, Im running awesomewm (because it forces me to learn things like this) via lightdm but these specific things are being run as a user service.
systemctl --user add-wants autostart.target redshift.service
systemctl --user start autostart.targetIf you believe there is a better way to approach the auto start-up these apps, Im more than willing to try.
Offline
Why are you using autostart.target? Redshift's service file is set up to wait for the display manager if you are using one and it is doing what it's supposed to. You are using lightDM which meets the first criteria - as for the second, I never really expect DMs to do what they are supposed to.
That said, if you're using a DM, it should read xprofile which seems to me to be a far far cleaner, simpler, and reliable method of starting programs for your graphical session than any of the desktop autostart systems or (ab)using systemd user services.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
While trilbys concerns are valid, you haven't done anything to "enable" the service which is what will allow the on boot/on login logic. You can remove your wants, that user services are started after the user bus is set up is implied by what they are and you need to add an install section depending on the default.target, as you are indeed using a DM this should inherit all the relevant xorg variables. So your service file should add a
[Install]
WantedBy=default.targetand then you need to just do a
systemctl --user enable $yourservicenamethere's not really much point to defining a custom target here. Additionally you probably don't want to start bash because then the process you are actually running is intransparent again but instead set these relevant additional environments as part of the service where they belong to, so to sum it up your service should look like
[Unit]
Description=Package Update Notifier
[Service]
Environment="GDK_BACKEND=x11"
ExecStart=/bin/pamac-tray"
Restart=always
[Install]
WantedBy=default.targetMaybe read https://wiki.archlinux.org/title/Systemd/User instead of trying to adapt some specific utilities special tooling to a normal service.
As this is explicitly a User service question and thus runs afoul of the current forum scope I'll move this to the NC.
Last edited by V1del (2022-01-04 08:37:20)
Offline
Thank you so much for your help, perhaps I should take a step back and explain some things further.
The reason why Im doing this is because nothing auto starts after the user logs in.
This is why I started using dex then autostart. So now I have to assume, because a tiling wm is so new to me and so much needs to be setup in comparison to other wms, I thought this was something I needed to implement. Instead it seems like its a problem that I should be troubleshooting.
(This is why Ive given examples such as redshift, GDK_BACKEND=x11, etc)
Right now I dont have .xprofile .profile or /etc/xprofile.... so.... yeah... perhaps this whole attempt is an exercise in futility.
Again, thank you guys for helping me thought this
Last edited by JessicaJill (2022-01-04 13:09:41)
Offline
nothing auto starts after the user logs in
https://wiki.archlinux.org/title/Awesome#Autostart
https://wiki.archlinux.org/title/LightD … ~/.xinitrc
https://wiki.archlinux.org/title/LightD … on_wrapper
Offline
Thank you...
I did read those and to quote the first link you sent
'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- [url]https://github.com/jceb/dex[/url] This is basically what I quoted in my first thread and reading further, if you open https://github.com/jceb/dex you will see where he says, "I consider systemd/user as a good alternative for dex's autostart functionality and switched to it recently. In particular, systemd solves the issue of dex losing control over the started processes which causes processes to live longer than the X session which could cause additional annoyances like reboots taking a lot of time because the system is waiting for the processes to terminate."
So now it feels like we have come full circle and were back to the beginning.
Offline
There're multiple ways to autostat stuff w/ a session which are all acceptable. dex is only one of them being mentioned even for awesome.
The approach in the dex github frankly seems overly cumbersome, and even if you add all the name-required services to match dex created .desktop services, you'll still have to add "systemctl --user start autostart.target" to your awesome start script in order to trigger their execution.
If you want a certain service to start w/ your session using system rather than xdg, see https://wiki.archlinux.org/title/Systemd/User and simply enable it as user service.
Offline
Looks like I have a lot more reading to do, thanks.
Offline
Pages: 1