aboutsummaryrefslogtreecommitdiff
path: root/set-theme
diff options
context:
space:
mode:
Diffstat (limited to 'set-theme')
-rwxr-xr-xset-theme80
1 files changed, 80 insertions, 0 deletions
diff --git a/set-theme b/set-theme
new file mode 100755
index 0000000..db06373
--- /dev/null
+++ b/set-theme
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+# CONFIG
+ignore_background_color="#04000a"
+highlight="#08000a"
+default_theme="tokyo-night"
+
+# END CONFIG
+cd "$(dirname "$0")"
+
+ignore_file=0
+list_files=0
+ignore_background=0
+run_pywal=0
+set_wallpaper=0
+
+while getopts "h?lpbw" opt; do
+ case "$opt" in
+ h)
+ printf -- "-l list themes
+-p run pywall
+-b ignore background and use one defined in script
+-w set wallpaper with setwll if \$wallpaper exist"
+ exit 0
+ ;;
+ l) list_files=1
+ ;;
+ b) ignore_background=1
+ ;;
+ p) run_pywal=1
+ ignore_file=1
+ ;;
+ w) set_wallpaper=1
+ ;;
+ esac
+done
+
+shift $((OPTIND-1))
+[ "${1:-}" = "--" ] && shift
+
+theme_file=$1
+
+if [ $list_files == 1 ]; then
+ ls $1 ./themes/
+ exit 0
+fi
+
+if [ "$theme_file" == "" ]; then
+ theme_file="$default_theme"
+fi
+
+if [ $ignore_file == 0 ]; then
+ source ./themes/$theme_file.sh || exit 1
+fi
+
+
+if [ $run_pywal == 1 ]; then
+ if [ $(pgrep hyprpaper) ]; then
+ wallpaper=$(hyprctl hyprpaper listactive | grep HDMI | sed 's/HDMI-A-1 = //')
+ wal -seti "$wallpaper"
+ . "$HOME/.cache/wal/colors.sh"
+ [ $ignore_background == 1 ] && background="$ignore_background_color"
+ else
+ echo NO AVAILABLE WALLPAPER ENGINE
+ echo please define wallpaper
+ exit 1
+ fi
+fi
+
+[ $ignore_background == 1 ] && background="$ignore_background_color"
+
+runs_dir="$(find ./targets -mindepth 1 -maxdepth 1 -type f -executable)"
+for s in $runs_dir; do
+ source "$s"
+done
+
+echo $wallpaper
+if [ $set_wallpaper == 1 ] && [ "$wallpaper" ]; then
+ setwll -ua "$wallpaper"
+fi