swww animated wallpapers

swww is pretty

i’ve been diving deep into my operating system with new skills since the last time i checked it over. as part of that i’ve setup a wallpaper, and to celebrate modern technology i decided to go with an animated background! s

enter swww, billed as a solution to wayland’s wallpaper woes. pretty nice name! On a X11, i could start up a feh instance in my profile, but i’ve switched to Wayland for awhile now and want to take advantage of newer software.

a look at swww

swww is one of a couple popular choices for setting a wallpaper. the other i used prior was swaybg. what drew me to swww was:

  • written in Rust which i am working hard on this year
  • animated wallpapers and transitions
  • daemon design with hot reloading

i have been interested in writing native graphical programs in Rust, so this is part of the appeal. swww is written using the popular Smithay’s toolkit. the GitHub had a preview that looks pretty stunning!

pain points of swww

when switching from swww, it acts as a daemon instead of a single program so it can raise new challenges to manage. the project is also relatively newer so it’s natural to expect more bugs, though it has already matured quickly due to the intentional narrow scope by the developer. this is also why there are no plans to expand it’s functionality, the developer prefers end users would extend it with shells scripts which is fine.

to this end, usually the ways i observe it started are in the shell script for login or the WM has exec functionality. i tried both of these, but i did not behave as expected.

starting swww at login

in Hyprland i tried two ways, the first did not work. it involved adding it to an exec line in .config/hypr/hyprland.conf. i tried moving it to other areas, and finally settled on using systemd user service to get the expected behaviour.

swww.service

~/.config/systemd/user/swww.service
[Unit]
Description=swww

[Service]
Type=forking
ExecStart=/usr/bin/swww init
ExecStop=/usr/bin/swww kill
Environment=DISPLAY=:0
Slice=session.slice
Restart=on-failure

[Install]
WantedBy=default.target

create the above file and then as the user you login to run:

systemctl --user enable --now swww

the daemon should start immediately and it will be activated at boot time in the future. now you probably want to setup a wallpaper. swww has a subcommand swww img ~/path/to/image that you can use! swww employs a cache that will save your last wallpaper and restore it on the next boot!

this is the extend of my needs, but i have seen more interesting ways people are using swww to change their wallpaper on a schedule or in response to certain activity that could be fun to consider for the future!