#!/bin/bash # A script to generate a theme for my system (auto-rice) # Dependencies: pywal, feh, xdotool # By David Penkowoj, 2022-01-31 # Usage: wally {path to image} [backend] [saturation value] backend="colorz" saturation="0.5" wallpaperDir="$HOME/images/wallpapers" cachedWallpaperFile="$HOME/.config/wallpaper" setTheme() { echo "Overwriting previous color backup with current colors." mv "$HOME/.cache/wal/colors" "$HOME/.cache/wal/oldcolors" echo "Generating new color scheme." wal -i "$1" -q -b "#1a1a1a" --saturate "$saturation" echo "Caching wallpaper." cp "$1" "$cachedWallpaperFile" echo "Setting wallpaper." feh --bg-fill "$cachedWallpaperFile" echo "Updating various software with rica." rica echo "Refreshing window manager." xdotool key Super_L+r } if [[ -n "$3" ]]; then echo "Got saturation value '$3'." saturation="$3" else echo "Did not recieve saturation value as third argument" fi if [[ -n "$2" ]]; then echo "Got backend value '$2'." backend="$2" else echo "Did not recieve backend value as second argument" fi if [[ -f "$1" ]]; then echo "Image found in relative directory." setTheme "$1" else echo "File not found, searching wallpaper directory." if [[ -f "$wallpaperDir/$1" ]]; then echo "Image found in wallpaper directory." setTheme "$wallpaperDir/$1" else echo "No image found." fi fi