Automatically Change GNOME Wallpaper Every 30 Minutes with a systemd Timer

Automatically Change GNOME Wallpaper Every 30 Minutes with a systemd Timer

If you already have a script that randomly changes your GNOME wallpaper, you can use a systemd user timer to run it automatically at regular intervals.

In this example, the wallpaper will be changed every 30 minutes.

How it works

A systemd timer does not run the wallpaper script directly. Instead, the timer activates a systemd service, and the service runs the script:

TEXT
wallpaper.timer
      │ every 30 minutes
wallpaper.service
random_wallpaper_gnome_v2.sh
GNOME wallpaper changes

We will create two files:

  • wallpaper.service — defines what should be executed.
  • wallpaper.timer — defines when the service should be executed.

This example uses a user systemd service, so everything is managed with systemctl --user.

Prerequisites

This tutorial assumes that you already have a script that changes your GNOME wallpaper.

For example:

TEXT
/path/to/script/random_wallpaper_gnome_v2.sh

Make sure the script is executable:

BASH
chmod +x /path/to/script/random_wallpaper_gnome_v2.sh

Replace the path above with the actual location of your script.

Create the systemd user directory

Create the directory for user systemd units if it does not already exist:

BASH
mkdir -p ~/.config/systemd/user

We will create the following files:

TEXT
~/.config/systemd/user/
├── wallpaper.service
└── wallpaper.timer

Create the systemd service

Create:

TEXT
~/.config/systemd/user/wallpaper.service

with the following content:

INI
[Unit]
Description=Change GNOME wallpaper

[Service]
Type=oneshot
ExecStart=/path/to/script/random_wallpaper_gnome_v2.sh

Change ExecStart to the actual path of your wallpaper script.

The important part here is:

INI
Type=oneshot

The service performs one task and then exits. It is therefore a good fit for a script that changes the wallpaper once and finishes.

Create the systemd timer

Next, create:

TEXT
~/.config/systemd/user/wallpaper.timer

with:

INI
[Unit]
Description=Change GNOME wallpaper every 30 minutes

[Timer]
OnActiveSec=30min
OnUnitActiveSec=30min
Unit=wallpaper.service

[Install]
WantedBy=timers.target

There are two important settings here.

OnActiveSec

INI
OnActiveSec=30min

This waits 30 minutes after the timer becomes active before the first execution.

OnUnitActiveSec

INI
OnUnitActiveSec=30min

This schedules the next execution 30 minutes after the associated service was last activated.

Therefore, the timer behaves approximately like this:

TEXT
Timer starts
     │ 30 minutes
Run wallpaper.service
     │ 30 minutes
Run wallpaper.service
     │ 30 minutes
Run wallpaper.service
    ...

Reload systemd

After creating or modifying the unit files, tell systemd to reload them:

BASH
systemctl --user daemon-reload

Enable and start the timer

Enable the timer so it starts automatically with your user systemd session:

BASH
systemctl --user enable wallpaper.timer

Then start it:

BASH
systemctl --user start wallpaper.timer

Or, equivalently, enable and start it in one command:

BASH
systemctl --user enable --now wallpaper.timer

You can now check its status:

BASH
systemctl --user status wallpaper.timer

Check the scheduled time

The list-timers command is useful for seeing when the timer last ran and when it will run next:

BASH
systemctl --user list-timers

You should see an entry similar to:

TEXT
NEXT                         LEFT     LAST
Wed 2026-08-26 16:30:00 ...  20min    Wed 2026-08-26 16:00:00 ...

The exact times will depend on when you started the timer.

Test the wallpaper service manually

You don’t have to wait 30 minutes to test whether the service works.

Run it manually:

BASH
systemctl --user start wallpaper.service

If the wallpaper changes, the service and your script are working correctly.

If it doesn’t, you can check the service logs:

BASH
journalctl --user -u wallpaper.service

For a more detailed view of recent messages:

BASH
journalctl --user -u wallpaper.service -n 50

This is also a useful way to diagnose problems with the wallpaper script itself.

Timer vs. service

It’s useful to understand why there are two files.

The service describes the action:

INI
[Service]
Type=oneshot
ExecStart=/path/to/script/random_wallpaper_gnome_v2.sh

The timer describes the schedule:

INI
[Timer]
OnActiveSec=30min
OnUnitActiveSec=30min

This separation is one of the useful features of systemd. The same service could potentially be triggered manually, by a timer, or by another systemd unit.

Run at fixed times instead

The configuration above uses a relative interval: the next execution occurs 30 minutes after the previous activation.

If you instead want the wallpaper to change at fixed times, such as:

TEXT
10:00
10:30
11:00
11:30
12:00
...

you can use OnCalendar instead.

For example:

INI
[Timer]
OnCalendar=*:0/30
Unit=wallpaper.service

This is different from OnActiveSec/OnUnitActiveSec because the schedule is based on calendar time rather than the time when the timer or service was activated.

For a simple “every 30 minutes after I start the timer” behavior, the original configuration is sufficient.

Disable the timer

If you want to stop the automatic wallpaper changes:

BASH
systemctl --user disable --now wallpaper.timer

The service and timer files can remain in place. You can enable the timer again later with:

BASH
systemctl --user enable --now wallpaper.timer

Remove the timer completely

If you no longer need the timer, first stop and disable it:

BASH
systemctl --user disable --now wallpaper.timer

Then remove the unit files:

BASH
rm ~/.config/systemd/user/wallpaper.timer
rm ~/.config/systemd/user/wallpaper.service

Finally, reload systemd:

BASH
systemctl --user daemon-reload

Troubleshooting

If the timer doesn’t appear to work, check the following.

1. Verify that the timer is running

BASH
systemctl --user status wallpaper.timer

2. Check the timer schedule

BASH
systemctl --user list-timers

3. Run the service manually

BASH
systemctl --user start wallpaper.service

If this fails, the problem is probably with the service configuration or wallpaper script rather than the timer.

4. Check the service log

BASH
journalctl --user -u wallpaper.service

5. Check that the script is executable

BASH
ls -l /path/to/script/random_wallpaper_gnome_v2.sh

If necessary:

BASH
chmod +x /path/to/script/random_wallpaper_gnome_v2.sh

Conclusion

A systemd user timer is a simple way to periodically run a wallpaper-changing script without keeping another program running in the background.

The basic setup consists of:

TEXT
wallpaper.service
    └── runs the wallpaper script

wallpaper.timer
    └── starts wallpaper.service every 30 minutes

Once the timer is enabled, systemd takes care of running the script automatically.

If you already have a script that changes your GNOME wallpaper, this approach lets you turn it into a fully automated wallpaper rotation with only a couple of systemd unit files.

License

Author: Vorasilp K.

Link: https://vorasilp.com/posts/wallpaper-timer/

License: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.