You are not logged in.
Pages: 1
I'm trying to get XDG autostart working as described on this page linked from archwiki here. It says
Desktop Environments can opt-in to using this by starting xdg-desktop-autostart.target.
so I tried running
systemctl start xdg-desktop-autostart.target
which returned
Failed to start xdg-desktop-autostart.target: Unit xdg-desktop-autostart.target not found.
Do I need to create it? I don't know what I would put in it. I also came across the SYSTEMD.SPECIAL(7) man page, which says
xdg-desktop-autostart.target
The XDG specification defines a way to autostart applications using XDG desktop files. systemd ships systemd-xdg-autostart-generator(8) for the XDG desktop files in autostart directories. Desktop Environments can opt-in to use this service by adding a Wants= dependency on xdg-desktop-autostart.target.Added in version 246.
I'm running systemd version 256 but I don't know what dependencies I would be adding to xdg-desktop-autostart.target. I would expect to make my desktop dependent on it rather than the other way around. My goal is to get XDG autostart working under Hyprland. Can anyone point me in the right direction?
Offline
It's a user service so you would need the --user option.
Para todos todo, para nosotros nada
Offline
Thank you! For anyone else who sees this: xdg-desktop-autostart sets
RefuseManualStart=yes
meaning it can't be enabled directly. The same is true of graphical-session.target, which the auto-generated services are started by. I was starting Hyprland manually so I created a unit file for it
[Unit]
Description=Hyprland Wayland compositor
Wants=graphical-session.target
Wants=xdg-desktop-autostart.target
[Service]
ExecStart=/usr/bin/Hyprland
Type=simple
[Install]
WantedBy=graphical.target
Now I start it with
systemctl --user start hyprland
I'm now successfully starting aa-notify this way but not yet firefox; it seems to be trying to start before Hyprland is available
Error: no DISPLAY environment variable specified
Offline
Environmental variables can be set directly in the unit file with the Environment= key or exported per-user with sytemctl's set-environment option: https://wiki.archlinux.org/title/System … er_service
Para todos todo, para nosotros nada
Offline
Which unit file do you mean? The Firefox unit file is auto-generated. I'm also surprised that it needs DISPLAY set at all, since I understand that to be an X11 variable.
Offline
https://wiki.archlinux.org/title/Firefox#Xwayland
You're probably also lacking WAYLAND_DISPLAY which is why FF falls back to X11/xwayland
Try to set it in your hyprland service
Offline
I tried setting both DISPLAY and WAYLAND_DISPLAY in my Hyprland unit file
[Unit]
Description=Hyprland Wayland compositor
Wants=graphical-session.target
Wants=xdg-desktop-autostart.target
[Service]
ExecStart=/usr/bin/Hyprland
Type=simple
Environment="WAYLAND_DISPLAY=wayland-1 DISPLAY=:0"
[Install]
WantedBy=graphical.target
but Firefox still isn't happy
Oct 16 23:36:56 titanium systemd[672]: Starting Firefox...
Oct 16 23:36:56 titanium systemd[672]: Started Firefox.
Oct 16 23:36:56 titanium firefox[696]: Error: no DISPLAY environment variable specified
Oct 16 23:36:56 titanium systemd[672]: app-firefox@autostart.service: Main process exited, code=exited, status=1/FAILURE
Oct 16 23:36:56 titanium systemd[672]: app-firefox@autostart.service: Failed with result 'exit-code'.
I found this, which at first glance seems to be exactly what I'm trying to do. I'm going to have a deeper look at it and see whether I can use it directly or learn what I'm missing.
Offline
You'll need that in the service that actually starts FF, systemd is generally unsuited for this kind of stuff (and frankly, pretty much everything else…) because the user session isn't bound to a specific display server.
https://wiki.archlinux.org/title/System … _variables
If hyprland doesn't implement xdg autostart itself, use dex and run it from the hyprland config.
https://wiki.archlinux.org/title/XDG_Autostart
Offline
The Firefox unit is automatically generated by systemd-xdg-autostart-generator so I don't want to edit it directly. I'm aware of dex but the readme recommends systemd as the way to handle autostart (https://github.com/jceb/dex?tab=readme- … lternative).
Offline
https://wiki.archlinux.org/title/Systemd#Drop-in_files
The alternative is to set the environment unconditionally, https://wiki.archlinux.org/title/Enviro … s#Per_user - which is batshit crazy. I'm talking "play the ave maria" levels of insanity here
The only way this would reasonably work is if systemd-autodings would inherit the environment of the session process.
Maybe "systemctl --user import-environment" in your hyprland config will do, but this still remains somewhat racy.
https://wiki.archlinux.org/title/System … _variables
Offline
Thanks, looks like I still have some reading to do.
Offline
Pages: 1