-
Notifications
You must be signed in to change notification settings - Fork 24
/
patch-dark-mode.sh
35 lines (28 loc) · 926 Bytes
/
patch-dark-mode.sh
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
#!/bin/bash
# Ensure Spicetify is in PATH
if ! command -v spicetify &> /dev/null; then
echo "Error: spicetify not found. Ensure it is installed and available in your PATH."
exit 1
fi
# Find where the Spotify binary is located
spotify_path=$(spicetify config spotify_path)
# Check for spicetify errors
if [[ $spotify_path == error* ]]; then
echo "Failed to patch the file. $spotify_path"
exit 1
fi
# Assemble the binary's path
if [[ "$OSTYPE" == "darwin"* ]]; then
_spotify_path=$(dirname "$spotify_path")
path="${_spotify_path}/MacOS/Spotify"
else
path="${spotify_path}/spotify"
fi
# Validate the path to ensure it exists and is a file
if [[ ! -f "$path" ]]; then
echo "Error: The Spotify binary was not found at the expected path: $path"
exit 1
fi
# Patch the binary
sed -i.bak 's/force-dark-mode/xxxxx-xxxx-xxxx/' "$path"
echo "The patch is complete. You may now restart Spotify."