Skip to content

OwenFeik/reddit_wp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Reddit Wallpaper

This script selects an image from a subreddit (or subreddits) of your choosing, downloads it, and sets it as your wallpaper. It should work on windows, and on linux setups where feh is available to set wallpaper and xrandr is available to check screen resolution. Python requests is the only other dependency.

A configuration file will be created when the script is first run, looking like so:

{
    "subreddits": [
        "earthporn"
    ],
    "resolution": "system",
    "download_folder": "images",
    "selection": "random",
    "backup_image": ""
}

To customise the script, you can edit these fields:

  • subreddits contains a list of subreddits to pull images from. These can just be a subreddit name, in which case images will be pulled from hot, or they can be of the form "subname/<view>:<quantity>" where <quantity> is a number of posts to retrieve less than or equal to 100 (numbers greater than 100 will be defaulted to 100) and <view> is one of:
    • new
    • rising
    • controversial
    • day
    • week
    • month
    • year
    • all
  • resolution defines the minimum image resolution and the number of images required; by default, when set to "system", this will be determined automatically based on screen resolution and number of monitors. Otherwise, a dictionary must be provided, of the form
{
    "width": 1920,
    "height": 1080,
    "monitors": 1
}
// The monitors key is only relevant on Linux as
// on windows the same image will be used for all monitors.
// Setting monitors to 1 will cause the same behaviour on Linux.
  • download_folder is the folder downloaded images are saved to. By default, this is a folder called "images" in the installation folder.
  • selection determines how the image is chosen; by default, the front page of each subreddit is joined and a random image is chosen from this. Three other modes can also be used: "top" will use the image with the highest score, "score" will select randomly weighted by score and "rough" will select randomly with weights of sqrt(score).
  • backup_image is the image used if no image of sufficient resolution is found. It can either be an absolute path ("C:\path\to\image, "~/path/to/image", etc) or a path relative to the download folder ("image", "../image", etc).

If you plan on using the script with a polybar setup, the following module may be of use:

[module/wallpaper]
type = custom/script
exec = echo "⏬"
click-left = "python ~/path/to/reddit_wp.py &"

If you plan on using the script on windows, the included file reddit_wp.vbs may be useful. It should run the script for you, and can be easily run at startup through the following method:

  • press Super + R to open the Run dialog.
  • enter shell:startup and press OK.
  • create a shortcut to reddit_wp.vbs in the startup folder.

About

Set wallpaper to image pulled from subreddit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published