A bash script that changes the desktop background every x amount of hours. And can detect climate conditions, to match the weather.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Patxi Pierce 49f91efc6e へ(゜∇、°)へ 5 months ago
inkscape-originals へ(゜∇、°)へ 5 months ago
wallpapers ԅ[ ˵ ☯ ڡ ☯ ˵ ]凸 6 months ago
.gitignore ԅ[ ˵ ☯ ڡ ☯ ˵ ]凸 6 months ago
LICENSE Initial commit 3 years ago
README.md (´⊙ω⊙`)ᵒᵐᵍᵎᵎᵎ 6 months ago
background-weather.example.conf (灬ºωº灬) 5 months ago
background-weather.sh ヾ (✿>﹏ ⊙〃)ノ 5 months ago

README.md

background-weather.sh

A bash script that changes the desktop background to adjust to time and season.

ToDo

  • Make wallpapers for all seasons.
  • Use timezone to make night or day longer.
  • Detect environment type to set wallpaper (only tested in raspbian and debian).
  • Make default SVG files

Installation

Ideally you just clone this repo and make a link to your bin directory.

git clone https://git.patxipierce.com/pxi/background-weather.git
mkdir -p /home/$USER/bin/
ln -s ./background-weather/background-weather.sh /home/$USER/bin/

Then setup a cron job:

crontab -e

And add the following to update every hour:

0 * * * * /home/$USER/bin/background-weather.sh

Usage

Since the addition of parameters such as -w you can input the weather to influence the outcome of the wallpaper.

--img File

Override the file, but still apply season, weather, etc.

  • Default: null
  • E.g background-weather.sh -f mybackground.png

--weather or -w Weather

Checks for the named weather directory inside the wallpapers folder.

  • Default: clear
  • E.g background-weather.sh --weather snowing

--api-key OpenWeatherMap API key

Your OpenWeatherMap API key (you can get one for free)

  • Default: ""
  • E.g background-weather.sh --api-key 1234567890abcdef

--lat and --lng Latitude & Longitude

This will affect the daylight hours expressed in the backgrounds.

  • Default: false
  • E.g background-weather.sh --lat 15.23456 --lng -30.67890

--test or -t Test mode

Returns the path to the existing file. Useful for implementing the script for other distros.

  • Default: false
  • E.g. background-weather.sh --test

Configuration File

To use the conf file rename background-weather.conf.example to background-weather.conf and put it in any of these locations:

  • /etc/background-weather.conf
  • ./background-weather.conf
  • ~/.config/background-weather/background-weather.conf

Files will be chosen by that same order.

Then fill in your API key and latitude and longitude and you are ready to go.

Customizing

The wallpapers all go in the wallpaper directory, so a valid path culd be:

./wallpapers/$season/$weather/$file

For example:

./wallpapers/winter/snow/08-late-morning.png

Or:

./wallpapers/winter/08-late-morning.png

Or the default:

./wallpapers/08-late-morning.png

The available scripted paths are:

  • Season

    • spring
    • fall
    • summer
    • winter
  • Weather condition (see OpenWeatherMap Condition Codes)

    • ash
    • clear (default)
    • clouds
    • drizzle
    • dust
    • fog
    • haze
    • mist
    • rain
    • sand
    • smoke
    • snow
    • squall
    • thunderstorm
    • tornado
  • Filename (which can be):

    • 00-mid-night.png
    • 01-late-night.png
    • 02-early-vigil.png
    • 03-mid-vigil.png
    • 04-late-vigil.png
    • 05-dawn.png
    • 06-early-morning.png
    • 07-mid-morning.png
    • 08-late-morning.png
    • 09-early-forenoon.png
    • 10-mid-forenoon.png
    • 11-late-forenoon.png
    • 12-noon.png
    • 13-early-afternoon.png
    • 14-mid-afternoon.png
    • 15-late-afternoon.png
    • 16-early-evening.png
    • 17-mid-evening.png
    • 18-late-evening.png
    • 19-early-dusk.png
    • 20-mid-dusk.png
    • 21-late-dusk.png
    • 22-sunset.png
    • 23-early-night.png

Credits

Default wallpapers are from 8-bit Day.