0

I want to do something where I animate my desktop background when the computer boots up. However, I can't seem to find a way to make it run ONLY when I can see it running. When I put the script in init.d, it seems to work, but it runs before I can see the desktop background. Can I make it only run when the computer has fully booted up, or when the user logs in?

(I am using Ubuntu 20.04 LTS)

1
  • 1
    You don't say what desktop you are using, but all of them (AFAIK) have some way to add a startup program or script that runs when the user logs in. For example, in Lubuntu 18.04 it's under Preferences/Default Applications for LXSession/Autostart Sep 19, 2020 at 0:27

1 Answer 1

2

I ran into this same problem when trying to get a login sound played in XFCE. What I did was create a user service (called xfce4-login-sound.service) and placed the file in $HOME/.config/systemd/user:

[Unit]
Description=XFCE4 login sound (with delay)

[Service]
ExecStartPre=/bin/sleep 3   # <--- this is the key, adjust delay as needed
Type=oneshot
ExecStart=/usr/bin/canberra-gtk-play -i desktop-login

[Install]
WantedBy=default.target

Afterwards, I enabled the service:

systemctl enable --now --user xfce4-login-sound.service
4
  • +1 for using systemd at the user level.
    – user535733
    Sep 19, 2020 at 1:48
  • I tried doing the service with my command, but it doesn't seem to work. A problem might be that I seem to have a black screen for a while when I log in. Do you have any ideas as to how I could fix that? Sep 19, 2020 at 2:43
  • That could be a lot of things; sorry, but I'm not even sure where to begin. I would suggest, though, that you start a new topic so you'll get more focused responses. Sep 19, 2020 at 3:39
  • Nevermind, the script does not run. I followed what you did, and the script doesn't run. I made sure by making it play a sound, but it just won't run. I'm not sure what's going on. Sep 19, 2020 at 16:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .