Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AinaKANTY/dynamic-wallpaper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple bash script to set wallpapers according to current time, supporting multiple desktop environments and window managers.

gif

Features & Overview

  • Wallpaper setter: Automatically detected based on your environment.
  • Multi-environment: Automatically detects and supports your DE/WM (Wayland & X11).
  • Target specific monitors: Apply a wallpaper to a specific screen using the -m or --monitor flag (supports Hyprland, Sway, KDE, and XFCE).
  • Random Selection: Pick a random style from your installed ones using the -r or --random flag.
  • Manage Styles: Easily remove an installed style using the dwall rm <style> subcommand.
  • Smart Time Fallback: If an image for the current hour is missing, dwall automatically falls back to the previous available hour. You don't need exactly 24 images!
  • Multi-Format Auto-detection: Seamlessly searches for .jpg, .jpeg, .png, .webp, and .gif formats simultaneously.
  • Dynamic Theming: Supports Matugen (default) and Pywal (via -p flag) for automatic color scheme generation.
  • Safety First: Features a robust flock instance locking system to prevent overlapping runs, along with clean exits on system signals.
  • Scheduler: Compatible with Systemd Timers and Cronie.

Supported Environments

Wayland

Hyprland Sway Wayfire Niri Cosmic River Labwc Wayland

X11

GNOME KDE XFCE MATE Cinnamon LXDE Enlightenment X11

Color Generation (optional)

matugen pywal

The script uses Matugen by default if installed. If you prefer to use Pywal, you can force it by passing the -p or --pywal flag.

Dependencies

  • systemd or cronie: For the hourly timer.
  • Wallpaper Setters (install at least one based on your environment if not using a full DE):
    • Wayland: awww, hyprpaper, swaybg, or wbg. (Note: wpaperd is not supported).
    • X11: feh, nitrogen, hsetroot, or xwallpaper.
    • DEs: their built-in native tools.
  • matugen: For Material You dynamic colors (optional).
  • pywal: For dynamic color schemes (optional).

Installation

  1. Clone the repository:
git clone https://github.com/AinaKANTY/dynamic-wallpaper.git
cd dynamic-wallpaper
  1. Install
chmod +x install.sh
./install.sh

Usage Options

Usage: dwall [OPTION...]
       dwall rm <style>

Options:
   -h, --help            Show help message
   -p, --pywal           Use pywal to set terminal colors instead of matugen
   -s, --style <style>   Name of the style to apply
   -S, --setter <setter> Force a specific wallpaper setter
   -m, --monitor <name>  Target a specific monitor (ex: DP-1, eDP-1)
   -l, --list            List available styles
   -r, --random          Pick a random style

Automation

Systemd Timer

  1. Create the service (~/.config/systemd/user/[email protected]):
[Unit]
Description=Dynamic Wallpaper

[Service]
ExecStart=/usr/bin/dwall -s %i
  1. Create the timer (~/.config/systemd/user/dwall.timer):
[Unit]
Description=Dynamic Wallpaper Timer

[Timer]
OnCalendar=hourly
Persistent=true
Unit[email protected]

[Install]
WantedBy=timers.target
  1. Enable:
systemctl --user enable --now dwall.timer
systemctl --user start dwall@<style>.service # replace <style> by yours

Cronie

  1. Enable and start the cron daemon:
# systemd
sudo systemctl enable --now cronie
# runit (Artix/Void)
sudo ln -s /etc/runit/sv/cronie /run/runit/service/
  1. Make sure the service is running:
systemctl status cronie
  1. Get your environment variables:
env | grep -E '^(SHELL|DISPLAY|WAYLAND_DISPLAY|XDG_SESSION_TYPE|XDG_CURRENT_DESKTOP|DESKTOP_SESSION|DBUS_SESSION_BUS_ADDRESS|XDG_RUNTIME_DIR|HYPRLAND_INSTANCE_SIGNATURE|SWAYSOCK|NIRI_SOCKET|WAYFIRE_SOCKET|COSMIC_SESSION)='
  1. Open crontab and add your values:
crontab -e
# Replace <value> and <style> with your own values
# X11
0 * * * * DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /usr/bin/dwall -s <style>

# Wayland — Hyprland (replaces the value of HYPRLAND_INSTANCE_SIGNATURE with the one obtained in step 3)
0 * * * * XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-1 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus HYPRLAND_INSTANCE_SIGNATURE=<value> /usr/bin/dwall -s <style>

# Wayland — Sway
0 * * * * XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-1 SWAYSOCK=<value> /usr/bin/dwall -s <style>
  1. Verify the cron job is registered:
crontab -l

How to add own wallpapers

  1. Download a wallpaper set you like.
  2. Rename the wallpapers to match the hours of the day: 0 to 23 (e.g., 0.jpg for midnight, 12.png for noon).

    Note: Thanks to the Smart Fallback feature, you don't need exactly 24 images! If you only have images for 6, 12, and 18, the script will automatically keep showing 6.jpg until noon.

  3. Make a new directory in /usr/share/dynamic-wallpaper/images/ (e.g., mystyle) and copy your images into it.
  4. Run the program to test: dwall -s mystyle.

Tips

  • You can use dwall to change between your favorite wallpapers every hour.
  • You can use dwall as a picture slide, which can set your favorite photos as wallpaper every hour or every 15 minutes. Just create an appropriate timer.

Use HEIC Images

You may also want to use wallpapers from Dynamic Wallpaper Club. To do so, you need to convert .heic image file to either png or jpg format. Download a .heic image and extract it.

  • First install heif-convert on your system:
# Arch/Manjaro
sudo pacman -S libheif
# Debian/Ubuntu
sudo apt install libheif-examples
# RedHat/Fedora
sudo dnf install libheif libheif-tools
  • Move your .heic file in a directory and run following command to convert images.
# change to directory
cd Downloads/

# 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 steps to use these wallpapers with dwall.

More Wallpapers : The original author also created additional wallpaper sets, which are not added to this repository because of their big size. You can download these wallpapers set from here

undefined

Credits

About

A simple bash script to set wallpapers according to current time, supporting multiple desktop environments and window managers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%