Hyprland - systemd - script

Hi, and thanks in advance. First of all, I’m new to Linux, Endeavour, etc.

I’ve been experimenting with hyprland + waybar on EOS (no DE installed). I want to run a systemd timer that will launch a script that kills and restarts waybar. When I run the script from the command line, it works fine. But when I run it as a service, it kills waybar, but waybar does not relaunch.

The systemd timer and service units are installed in ~/.config/systemd/user/

I think this has something to do with the environment variables used by systemd, but I cannot figure it out.

Here is the service unit:

[Service]
Type=oneshot
ExecStart=/home/kirkham/dotfiles/scripts/get_bing_image.sh

[Install]
WantedBy=bingwallpaper.timer

:man_shrugging: It could be. Maybe you would need to set the display?

[Service]
Type=oneshot
Environment=DISPLAY=:0  # Adjust this if needed
ExecStart=/home/kirkham/dotfiles/scripts/get_bing_image.sh

Check for clues in the journal.

systemctl status --user bingwallpaper.service

Well, I figured it out. It had nothing to do with what I thought. Instead, the issue was the type of service. But instead it was an issue with the systemd service unit. It needed to be a fork instead of oneshot.