From e948f8d1208be49c2c4ab25f89d7478c88f9f365 Mon Sep 17 00:00:00 2001 From: Julien Maille Date: Tue, 2 Nov 2021 23:26:15 +0100 Subject: [PATCH] call spicetify apply after patching in install scripts --- install.ps1 | 30 +++++++++++++++++++----------- install.sh | 6 ++++-- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/install.ps1 b/install.ps1 index 411f503..dc2eb36 100644 --- a/install.ps1 +++ b/install.ps1 @@ -7,7 +7,7 @@ param ( $PSMinVersion = 3 if ($v) { - $version = $v + $version = $v } # Helper functions for pretty terminal output. @@ -32,8 +32,8 @@ if ($PSVersionTable.PSVersion.Major -gt $PSMinVersion) { $checkSpice = Get-Command spicetify -ErrorAction Silent if ($null -eq $checkSpice) { - Write-Host -ForegroundColor Red "Spicetify not found" - Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/khanhas/spicetify-cli/master/install.ps1" | Invoke-Expression + Write-Host -ForegroundColor Red "Spicetify not found" + Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/khanhas/spicetify-cli/master/install.ps1" | Invoke-Expression } if (-not $version) { @@ -95,26 +95,34 @@ if ($PSVersionTable.PSVersion.Major -gt $PSMinVersion) { spicetify config current_theme DribbblishDynamic spicetify config color_scheme base spicetify config inject_css 1 replace_colors 1 overwrite_assets 1 - spicetify apply Write-Done # Add patch Write-Part "PATCHING "; Write-Emphasized "config-xpui.ini" $configFile = Get-Content "$spicePath\config-xpui.ini" if (-not ($configFile -match "xpui.js_find_8008")) { - $rep = @" + $rep = @" [Patch] xpui.js_find_8008=,(\w+=)32, xpui.js_repl_8008=,`${1}58, "@ - # In case missing Patch section - if (-not ($configFile -match "\[Patch\]")) { - $configFile += "`n[Patch]`n" - } - $configFile = $configFile -replace "\[Patch\]",$rep - Set-Content "$spicePath\config-xpui.ini" $configFile + # In case missing Patch section + if (-not ($configFile -match "\[Patch\]")) { + $configFile += "`n[Patch]`n" + } + $configFile = $configFile -replace "\[Patch\]",$rep + Set-Content "$spicePath\config-xpui.ini" $configFile } Write-Done + + Write-Part "APPLYING"; + $backupVer = $configFile -match "^version" + $version = ConvertFrom-StringData $backupVer[0] + if ($version.version.Length -gt 0) { + spicetify apply + } else { + spicetify backup apply + } } else { Write-Part "`nYour Powershell version is less than "; Write-Emphasized "$PSMinVersion"; diff --git a/install.sh b/install.sh index 6206fab..5931edb 100644 --- a/install.sh +++ b/install.sh @@ -55,7 +55,6 @@ spicetify config extensions default-dynamic.js- extensions dribbblish.js- extens spicetify config current_theme DribbblishDynamic spicetify config color_scheme base spicetify config inject_css 1 replace_colors 1 overwrite_assets 1 -spicetify apply echo "PATCHING" PATCH='[Patch] @@ -65,4 +64,7 @@ if cat config-xpui.ini | grep -o '\[Patch\]'; then perl -i -0777 -pe "s/\[Patch\].*?($|(\r*\n){2})/$PATCH\n\n/s" config-xpui.ini else echo -e "\n$PATCH" >> config-xpui.ini -fi \ No newline at end of file +fi + +echo "APPLYING" +spicetify apply \ No newline at end of file