aboutsummaryrefslogtreecommitdiff
path: root/scripts/.local/bin/personal/wally
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/.local/bin/personal/wally')
-rwxr-xr-xscripts/.local/bin/personal/wally56
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/.local/bin/personal/wally b/scripts/.local/bin/personal/wally
new file mode 100755
index 0000000..91ab90e
--- /dev/null
+++ b/scripts/.local/bin/personal/wally
@@ -0,0 +1,56 @@
+#!/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
+