blob: 516ee887577d886752e22c2010854e47ca5540bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/bin/sh
# CONFIG
ignore_background_color="#04000a"
highlight="#08000a"
default_theme="tokyo-night"
# END CONFIG
cd "$(dirname "$0")" || exit
ignore_file=0
list_files=0
ignore_background=0
run_pywal=0
set_wallpaper=0
while getopts "hlpbw" 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
;;
*) break;;
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
. "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
. "$s"
done
if [ "$wallpaper" ] && [ $set_wallpaper = 1 ]; then
setwll -ua "$wallpaper"
fi
|