blob: 9b13bcc04bffee402044bbdc915a5c7c50a2105b (
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
|
#!/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]
light_theme="no"
backend="wal" # colorz
saturation="0.5"
wallpaperDir="$HOME/images/wallpapers"
cachedWallpaperFile="$HOME/.config/wallpaper" # TODO: symlink to dotfiles
if [[ "$light_theme" = "yes" ]]; then
saturation="0.7"
fi
setTheme() {
echo "Overwriting previous color backup with current colors."
mv "$HOME/.cache/wal/colors" "$HOME/.cache/wal/oldcolors"
echo "Generating new color scheme."
if [[ "$light_theme" = "yes" ]]; then
wal -i "$1" -b "#ffffff" --saturate "$saturation" --backend "$backend" --cols16 -l
else
wal -i "$1" -b "#1a1a1a" --saturate "$saturation" --backend "$backend" --cols16
fi
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 [[ $1 == *.json ]]; then
wal --theme "$1"
walppr="$(cat "$1" | jq .wallpaper | sed 's/"//g')"
cp "$walppr" "$cachedWallpaperFile"
rica "$1"
xdotool key Super_L+Shift_L+r
exit 0
fi
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
|