-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpywal-to-spicetify.sh
More file actions
executable file
·50 lines (41 loc) · 1.56 KB
/
pywal-to-spicetify.sh
File metadata and controls
executable file
·50 lines (41 loc) · 1.56 KB
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
#!/bin/bash
WAL_COLORS="$HOME/.cache/wal/colors.json"
COLOR_INI="$HOME/.config/spicetify/Themes/text/color.ini"
SECTION="[Pywal]"
# extract colors from pywal
accent=$(jq -r '.colors.color2' "$WAL_COLORS" | sed 's/#//')
main=$(jq -r '.special.background' "$WAL_COLORS" | sed 's/#//')
text=$(jq -r '.special.foreground' "$WAL_COLORS" | sed 's/#//')
subtext=$(jq -r '.colors.color7' "$WAL_COLORS" | sed 's/#//')
notification=$(jq -r '.colors.color4' "$WAL_COLORS" | sed 's/#//')
notification_error=$(jq -r '.colors.color1' "$WAL_COLORS" | sed 's/#//')
highlight=$(jq -r '.colors.color8' "$WAL_COLORS" | sed 's/#//')
header=$(jq -r '.colors.color0' "$WAL_COLORS" | sed 's/#//')
border=$(jq -r '.colors.color3' "$WAL_COLORS" | sed 's/#//')
# generate the [Pywal] section
cat <<EOF > /tmp/pywal_spicetify.ini
$SECTION
accent = ${accent}
accent-active = ${accent}
accent-inactive = ${main}
banner = ${accent}
border-active = ${accent}
border-inactive = ${border}
header = ${header}
highlight = ${highlight}
main = ${main}
notification = ${notification}
notification-error = ${notification_error}
subtext = ${subtext}
text = ${text}
EOF
# remove existing [Pywal] section if it exists
sed -i '/^\[Pywal\]/,/^\[.*\]/d' "$COLOR_INI"
# append new [Pywal] section
cat /tmp/pywal_spicetify.ini >> "$COLOR_INI"
# set the color scheme
spicetify config color_scheme Pywal
# apply it
spicetify apply
# remind the user to manually open spotify
sleep 2 && notify-send "Open Spotify to see the new look :)"