-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpicetifyMarketplace.ps1
55 lines (44 loc) · 2.77 KB
/
SpicetifyMarketplace.ps1
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
# Modified from https://github.com/JulienMaille/dribbblish-dynamic-theme/blob/main/install.ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Write-Host "Setting up..." -ForegroundColor "Green"
# $checkSpice = Get-Command & $env:LOCALAPPDATA\spicetify\spicetify.exe -ErrorAction Silent
# if ($null -eq $
# ) {
# Write-Host -ForegroundColor Red "Spicetify not found. Installing that for you..."
# Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1" | Invoke-Expression
# }
$spicePath = "$env:APPDATA\spicetify"
$sp_dot_dir = "$spicePath\CustomApps"
if (-not (Test-Path $sp_dot_dir)) {
Write-Host "Making a CustomApps folder..." -ForegroundColor "Cyan"
New-Item -Path $sp_dot_dir -ItemType Directory | Out-Null
}
Write-Host "Downloading..." -ForegroundColor "Green"
$latest_release_uri =
"https://api.github.com/repos/spicetify/spicetify-marketplace/releases/latest"
$latest_release_json = Invoke-WebRequest -Uri $latest_release_uri -UseBasicParsing
$version = ($latest_release_json | ConvertFrom-Json).tag_name -replace "v", ""
$download_uri = "https://github.com/spicetify/spicetify-marketplace/releases/download/" +
"v$version/spicetify-marketplace.zip"
Invoke-WebRequest -Uri $download_uri -UseBasicParsing -OutFile "$sp_dot_dir\marketplace.zip"
Write-Host "Unzipping and installing..." -ForegroundColor "Green"
Expand-Archive -Path "$sp_dot_dir\marketplace.zip" -DestinationPath $sp_dot_dir -Force
Remove-Item -Path "$sp_dot_dir\marketplace.zip" -Force
if (Test-Path -Path "$sp_dot_dir\marketplace") {
Write-Host "marketplace was already found! Updating..." -ForegroundColor "Cyan"
Remove-Item -Path "$sp_dot_dir\marketplace" -Force -Recurse
}
Rename-Item -Path "$sp_dot_dir\spicetify-marketplace-dist" -NewName "marketplace" -Force
& $env:LOCALAPPDATA\spicetify\spicetify.exe config custom_apps spicetify-marketplace-
& $env:LOCALAPPDATA\spicetify\spicetify.exe config custom_apps marketplace
# Color injection fix
& $env:LOCALAPPDATA\spicetify\spicetify.exe config inject_css 1
& $env:LOCALAPPDATA\spicetify\spicetify.exe config replace_colors 1
Write-Host "Applying placeholder theme..." -ForegroundColor "Cyan"
Remove-Item -Recurse -Force "$spicePath\Themes\marketplace" -ErrorAction Ignore
New-Item -Path "$spicePath\Themes\marketplace" -ItemType Directory | Out-Null
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/color.ini" -OutFile "$spicePath\Themes\marketplace\color.ini"
& $env:LOCALAPPDATA\spicetify\spicetify.exe config current_theme marketplace
& $env:LOCALAPPDATA\spicetify\spicetify.exe backup
& $env:LOCALAPPDATA\spicetify\spicetify.exe apply
Write-Host "Done! If nothing has happened, do spicetify apply" -ForegroundColor "Green"