adi1090x / dynamic-wallpaper

A simple bash script to set wallpapers according to current time, using cron job scheduler.
GNU General Public License v3.0
1.88k stars 115 forks source link
adi1090x arch-linux archcraft bash bash-scripts cron cronjob crontab dynamic-wallpaper linux live-wallpapers pywal timed-wallpaper ubuntu unixporn wallpaper wallpaper-manager wallpaper-set wallpaperengine wallpapers

A simple bash script to set wallpapers according to current time, using cron job scheduler.

gif

Overview

Dependencies

Install Following programs on your system before using dwall -

Install feh, cron and xrandr -

# On Archlinux
$ sudo pacman -Sy xorg-xrandr feh cronie

# On Ubuntu or Debian
$ sudo apt-get install x11-xserver-utils feh cron

For swaywm support users must install oguri. The oguri daemon must be started for the script to work. Oguri can be installed on Arch linux via AUR.

Installation

Follow the step below to install dwall on your system -

You can run test.sh to test it before installing it on your system.

Run the program

╺┳┓╻ ╻┏┓╻┏━┓┏┳┓╻┏━╸ ╻ ╻┏━┓╻ ╻ ┏━┓┏━┓┏━┓┏━╸┏━┓ ┃┃┗┳┛┃┗┫┣━┫┃┃┃┃┃ ┃╻┃┣━┫┃ ┃ ┣━┛┣━┫┣━┛┣╸ ┣┳┛ ╺┻┛ ╹ ╹ ╹╹ ╹╹ ╹╹┗━╸ ┗┻┛╹ ╹┗━╸┗━╸╹ ╹ ╹╹ ┗━╸╹┗╸

Dwall V3.0 : Set wallpapers according to current time. Developed By : Aditya Shakya (@adi1090x)

Usage : test.sh [-h] [-p] [-s style]

Options: -h Show this help message -p Use pywal to set wallpaper -s Name of the style to apply

Available styles: aurora beach bitday chihuahuan cliffs colony desert earth exodus factory firewatch forest gradient home island lake lakeside market mojave moon mountains room sahara street tokyo

Examples: test.sh -s beach Set wallpaper from 'beach' style test.sh -p -s sahara Set wallpaper from 'sahara' style using pywal


+ Select the style you like and run -

$ dwall -s firewatch [*] Using style : firewatch


### Setup cron job

This program is specifically created to use with a time-based job scheduler such as **cron** or **systemd/Timers**. So, After installing this program you need to set up a cron job using `crontab` on your system. Follow the step below to set a job for this program - 
> I'm using `cronie` on Arch Linux here.

- After installing `cron`, enable and start the cron service -
```bash
# On Arch Linux
$ sudo systemctl enable cronie.service --now

/usr/bin/zsh | /usr/local/bin:/usr/bin | :0 | Openbox | unix:path=/run/user/1000/bus | /run/user/1000


- Now, Create an hourly cron job for **dwall** using `crontab` -
```bash
# export editor for crontab
$ export EDITOR=vim

# Edit your crontab and add a job
$ crontab -e

# Add this line replacing the values of env variable and style with yours
0 * * * * env PATH=/usr/local/bin:/usr/bin DISPLAY=:0 DESKTOP_SESSION=Openbox DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" /usr/bin/dwall -s firewatch

# check if job is created on your crontab
$ crontab -l
0 * * * * env PATH=/usr/local/bin:/usr/bin DISPLAY=:0 DESKTOP_SESSION=Openbox DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" /usr/bin/dwall -s firewatch

Add new job with different style

$ crontab -e 0 env PATH=/usr/local/bin:/usr/bin DISPLAY=:0 DESKTOP_SESSION=Openbox DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" /usr/bin/dwall -s bitday


### How to add own wallpapers

+ Download a wallpaper set you like.
+ Rename the wallpapers (must be **jpg/png**) to `0-23`. If you don't have enough images, symlink them.
+ Make a directory in `/usr/share/dynamic-wallpaper/images` and copy your wallpapers in that. 
+ Run the program, select the style and apply it.

**`Tips`**
- You can use `dwall` to change between your favorite wallpapers every hour.
- You can use `dwall` as picture slide, which can set your favorite photos as wallpaper every hour or every 15 minutes. Just create an appropriate cron job.

### Use HEIC Images

You may also want to use wallpapers from [Dynamic Wallpaper Club](https://dynamicwallpaper.club/). To do so, you need to convert `.heic` image file to either png or jpg format. Download a `.heic` wallpaper file you like and follow the steps below to convert images.

- First install `heif-convert` on your system - 
```bash
# On Archlinux
$ sudo pacman -Sy libheif

# On Ubuntu or Debian
$ sudo apt-get install libheif-examples

convert to jpg images

$ for file in *.heic; do heif-convert $file ${file/%.heic/.jpg}; done


- Now, you have the images, just follow the [above](https://github.com/adi1090x/dynamic-wallpaper#How-to-add-own-wallpapers) steps to use these wallpapers with `dwall`.

**More Wallpapers :** I've also created a few more wallpaper sets, which are not added to this repository because of their big size. You can download these wallpapers set from here - 
<p align="center">
  <a href="https://github.com/adi1090x/files/tree/master/dynamic-wallpaper/wallpapers"><img alt="undefined" src="https://img.shields.io/badge/Download-Here-blue?style=for-the-badge&logo=github"></a>
</p>

**`Available Sets`** : `Catalina`, `London`, `Maldives`, `Mojave HD`, `Mount Fuji`, `Seoul`, and more...

### Previews

|Aurora|Beach|Bitday|Chihuahuan|
|--|--|--|--|
|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/aurora.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/beach.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/bitday.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/chihuahuan.gif)|

|Cliffs|Colony|Desert|Earth|
|--|--|--|--|
|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/cliffs.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/colony.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/desert.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/earth.gif)|

|Exodus|Factory|Forest|Gradient|
|--|--|--|--|
|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/exodus.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/factory.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/forest.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/gradient.gif)|

|Home|Island|Lake|Lakeside|
|--|--|--|--|
|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/home.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/island.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/lake.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/lakeside.gif)|

|Market|Mojave|Moon|Mountains|
|--|--|--|--|
|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/market.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/mojave.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/moon.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/mountains.gif)|

|Room|Sahara|Street|Tokyo|
|--|--|--|--|
|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/room.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/sahara.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/street.gif)|![gif](https://raw.githubusercontent.com/adi1090x/files/master/dynamic-wallpaper/tokyo.gif)|

### Common Issues

**1. Wallpaper not changing** : If your wallpaper is not changing, then open an issue and show me the output of `echo $DESKTOP_SESSION`.

**2. Not working on XFCE** : If this script is not working on xfce, then open the terminal and run `xfconf-query -c xfce4-desktop -m` and change the wallpaper (any) via *xfce4-settings-manager*. <br />
In the terminal, *xfconf-query* will print lines starting with `set:`, which show which properties have been changed, check `screen` & `monitor` values and modify the script accordingly.
```bash
109   ## For XFCE
110   if [[ "$OSTYPE" == "linux"* ]]; then
111      SCREEN="0"
112      MONITOR="1"
113   fi
  1. Autostart : If you want to autostart the script with desktop, you can add it to your WM autostart file & if it doesn't work for you, you can create a desktop file in $HOME/.config/autostart dir.
    
    $ cd $HOME/.config/autostart && touch dwall.desktop

Add this to dwall.desktop file

[Desktop Entry] Name=Dynamic Wallpaper Comment=Set desktop background according to current time. Exec=/usr/bin/dwall -s firewatch & Type=Application Icon=wallpaper Categories=Accessories;


> Alternatively, you can also put the `/usr/bin/dwall -s firewatch &` command in your `~/.bashrc` file.

### Quick FYI

+ In KDE, `dwall` changes the wallpaper in all the Activities.
+ While using with `pywal`, the color of other applications (Terminal, polybar, rofi, etc) will change the way you configured these application. It's on you.
+ You can add **`dwall -s style &`** to your WM's autostart file to set/restore wallpaper after login/reboot.
+ You can also create a `@reboot` crontab to set appropriate wallpaper on boot.