-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
75 lines (63 loc) · 2.67 KB
/
install.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# GPL license.
# Edited from project Denoland install script (https://github.com/denoland/deno_install)
param (
[string] $version
)
$PSMinVersion = 3
if ($v) {
$version = $v
}
# Helper functions for pretty terminal output.
function Write-Part ([string] $Text) {
Write-Host $Text -NoNewline
}
function Write-Emphasized ([string] $Text) {
Write-Host $Text -NoNewLine -ForegroundColor "Cyan"
}
function Write-Done {
Write-Host " > " -NoNewline
Write-Host "OK" -ForegroundColor "Green"
}
if ($PSVersionTable.PSVersion.Major -gt $PSMinVersion) {
$ErrorActionPreference = "Stop"
# Enable TLS 1.2 since it is required for connections to GitHub.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$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
}
# Check ~\.spicetify\Themes directory already exists
$spicePath = spicetify -c | Split-Path
$sp_dot_dir = "$spicePath\Themes"
Write-Part "MAKING FOLDER "; Write-Emphasized "$sp_dot_dir\Pocket"
Remove-Item -Recurse -Force "$sp_dot_dir\Pocket" -ErrorAction Ignore
New-Item -Path "$sp_dot_dir\Pocket" -ItemType Directory | Out-Null
Write-Done
# Clone to .spicetify.
Write-Part "DOWNLOADING "; Write-Emphasized $sp_dot_dir
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/LucyUwI/Pocket/main/Pocket/color.ini" -UseBasicParsing -OutFile "$sp_dot_dir\Pocket\color.ini"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/LucyUwI/Pocket/main/Pocket/user.css" -UseBasicParsing -OutFile "$sp_dot_dir\Pocket\user.css"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/LucyUwI/Pocket/main/Pocket.js" -UseBasicParsing -OutFile "$spicePath\Extensions\Pocket.js"
Write-Done
# Installing.
Write-Part "INSTALLING `r`n"
spicetify config extensions Pocket.js
spicetify config current_theme Pocket
spicetify config color_scheme Pink
Write-Done
# applying.
Write-Part "APPLYING";
$configFile = Get-Content "$spicePath\config-xpui.ini"
$backupVer = $configFile -match "^version"
if ($backupVer.Length -gt 0) {
spicetify apply
} else {
spicetify backup apply
}
Write-Done
}
else {
Write-Part "`nYour Powershell version is less than "; Write-Emphasized "$PSMinVersion";
Write-Part "`nPlease, update your Powershell downloading the "; Write-Emphasized "'Windows Management Framework'"; Write-Part " greater than "; Write-Emphasized "$PSMinVersion"
}