92 lines
2.0 KiB
Bash
Executable File
92 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# CONFIG
|
|
ignore_background_color="#04000a"
|
|
highlight="#08000a"
|
|
default_theme="catppuccin"
|
|
|
|
# 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
|
|
|
|
WALLPAPER var can be specified for a wallpaper (WALLPAPER=\"somepath\" set-theme -p)"
|
|
exit 0
|
|
;;
|
|
l) list_files=1
|
|
;;
|
|
b) ignore_background=1
|
|
;;
|
|
p) run_pywal=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 [ "$WALLPAPER" ]; then
|
|
wallpaper="$WALLPAPER"
|
|
fi
|
|
|
|
|
|
if [ $run_pywal == 1 ]; then
|
|
# if your wallpaper engine your using can get the current active wallpaper. add it here
|
|
if [ $(pgrep hyprpaper) ]; then
|
|
wallpaper=$(hyprctl hyprpaper listactive | grep HDMI | sed 's/HDMI-A-1 = //')
|
|
wal -seti "$wallpaper"
|
|
. "$HOME/.cache/wal/colors.sh"
|
|
else
|
|
if [ "$wallpaper" ]; then
|
|
wal -seti "$wallpaper"
|
|
. "$HOME/.cache/wal/colors.sh"
|
|
else
|
|
echo pywll
|
|
echo unknown current engine.
|
|
echo please specify a wallpaper yourself
|
|
echo see set-theme -h for more help
|
|
exit 1
|
|
fi
|
|
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
|
|
|
|
if [ $set_wallpaper == 1 ] && [ "$wallpaper" ]; then
|
|
setwll -ua "$wallpaper"
|
|
fi
|