Set wallpaper to the day's top image post in a subreddit
Go to file
Keith Irwin 8a2c88d82c
Improved sysd service waiting for network
2021-08-13 10:44:55 -06:00
LICENSE.md init commit 2021-07-06 21:27:40 -06:00
README.md #2 Added systemd 2021-07-07 00:42:17 -06:00
reddit-wallpaper Fixed user agent 2021-07-06 23:13:23 -06:00
reddit-wallpaper@.service Improved sysd service waiting for network 2021-08-13 10:44:55 -06:00

README.md

reddit-wallpaper

Set wallpaper to the day's top image post in a subreddit

Requirements

Works on xfce and should work on gnome. If your desktop environment has a command to change the wallpaper, please submit a PR.

Installation

sudo git clone https://gitea.gf4.pw/ki9/reddit-wallpaper.git /usr/local/src/reddit-wallpaper
sudo ln -s /usr/local/src/reddit-wallpaper/reddit-wallpaper /usr/local/bin/reddit-wallpaper

Updates

cd /usr/local/src/reddit-wallpaper
sudo git pull

Usage

xfce

In a terminal, start this command:

xfconf-query -c xfce4-desktop -m | cut -d ' ' -f2

Then, leaving that running, open the xfce settings and change the desktop background to a random image. You should see something like this:

monitoring

/backdrop/screen0/monitorHDMI-A-0/workspace0/last-image

Take the second line and use that as the second argument to the reddit-wallpaper command. As the third argument, use the name of the subreddit without the "r/". For example, using the above xfconf-query output, I could set my background to the day's top post on r/awww:

reddit-wallpaper /backdrop/screen0/monitorHDMI-A-0/workspace0/last-image awww

gnome

Coming soon

Systemd

Copy the service file to your systemd configuration directory:

sudo cp /usr/local/src/reddit-wallpaper/reddit-wallpaper@.service /etc/systemd/system
sudo systemctl daemon-reload

Now you can run the service with sudo systemctl start reddit-wallpaper@awww. You can also configure systemd timers. For example, you can use this timer to set the wallpaper to the top post on r/spaceporn every night at 8pm:

[Unit]
Description=Change desktop wallpaper to r/spaceporn's top evenings at 8pm

[Timer]
OnCalendar=20:00
Unit=reddit-wallpaper@spaceporn.service

[Install]
WantedBy=multi-user.target

Save that to /etc/systemd/system/space-wallpaper.timer and then run:

sudo systemctl daemon-reload
sudo systemctl start space-wallpaper.timer
sudo systemctl enable space-wallpaper.timer

License

reddit-wallpaper - Set wallpaper to the day's top image post in a subreddit
Copyright © 2021 Keith Irwin www.ki9.us

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.