NEW: install script

This commit is contained in:
Julien Maille 2021-06-03 23:11:10 +02:00
parent 8539ef806e
commit bc1a79a07f
3 changed files with 110 additions and 3 deletions

View file

@ -48,6 +48,8 @@ In **Bash**:
cd "$(dirname "$(spicetify -c)")/Themes/Dribbblish"
mkdir -p ../../Extensions
cp dribbblish.js ../../Extensions/.
cp dribbblish-dynamic.js ../../Extensions/.
cp Vibrant.min.js ../../Extensions/.
spicetify config extensions dribbblish.js
spicetify config extensions dribbblish-dynamic.js
spicetify config extensions Vibrant.min.js
@ -61,6 +63,8 @@ In **Powershell**:
```powershell
cd "$(spicetify -c | Split-Path)\Themes\Dribbblish"
Copy-Item dribbblish.js ..\..\Extensions
Copy-Item dribbblish-dynamic.js ..\..\Extensions
Copy-Item Vibrant.min.js ..\..\Extensions
spicetify config extensions dribbblish.js
spicetify config extensions dribbblish-dynamic.js
spicetify config extensions Vibrant.min.js

View file

@ -257,9 +257,11 @@ waitForElement([".cover-art-image"], (queries) => {
return response.json();
}).then(data => {
if( data.tag_name > current ) {
document.querySelector("#main-topBar-moon-div").classList.add("main-topBarUpdateAvailable")
document.querySelector("#main-topBar-moon-button").append(`NEW v${data.tag_name} available`)
document.querySelector("#main-topBar-moon-button").setAttribute("title", `Changes: ${data.name}`)
upd = document.createElement("div")
upd.classList.add("ellipsis-one-line", "main-type-finale")
document.querySelector(".main-userWidget-box").append(upd)
upd.append(`NEW v${data.tag_name} available`)
upd.setAttribute("title", `Changes: ${data.name}`)
}
}).catch(err => {
// Do something for an error here

101
install.ps1 Normal file
View file

@ -0,0 +1,101 @@
# Copyright 2019 khanhas. 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
if (-not $version) {
# Determine latest release via GitHub API.
$latest_release_uri =
"https://api.github.com/repos/JulienMaille/dribbblish-dynamic-theme/releases/latest"
Write-Part "DOWNLOADING "; Write-Emphasized $latest_release_uri
$latest_release_json = Invoke-WebRequest -Uri $latest_release_uri -UseBasicParsing
Write-Done
$version = ($latest_release_json | ConvertFrom-Json).tag_name -replace "v", ""
}
# Check ~\spicetify-cli\Themes directory already exists
$sp_dir = "${HOME}\spicetify-cli\Themes"
if (-not (Test-Path $sp_dir)) {
Write-Part "MAKING FOLDER "; Write-Emphasized $sp_dir
New-Item -Path $sp_dir -ItemType Directory | Out-Null
Write-Done
}
# Download release.
$zip_file = "${sp_dir}\${version}.zip"
$download_uri = "https://github.com/JulienMaille/dribbblish-dynamic-theme/archive/refs/tags/${version}.zip"
Write-Part "DOWNLOADING "; Write-Emphasized $download_uri
Invoke-WebRequest -Uri $download_uri -UseBasicParsing -OutFile $zip_file
Write-Done
# Extract theme from .zip file.
Write-Part "EXTRACTING "; Write-Emphasized $zip_file
Write-Part " into "; Write-Emphasized ${sp_dir};
Expand-Archive -Path $zip_file -DestinationPath $sp_dir -Force
Write-Done
# Remove .zip file.
Write-Part "REMOVING "; Write-Emphasized $zip_file
Remove-Item -Path $zip_file
Write-Done
# Check ~\.spicetify.\Themes directory already exists
$sp_dot_dir = "${HOME}\.spicetify\Themes\DribbblishDynamic"
if (-not (Test-Path $sp_dot_dir)) {
Write-Part "MAKING FOLDER "; Write-Emphasized $sp_dot_dir
New-Item -Path $sp_dot_dir -ItemType Directory | Out-Null
Write-Done
}
# Copy to .spicetify.
Write-Part "COPYING "; Write-Emphasized $sp_dot_dir
Copy-Item -Path "${sp_dir}\dribbblish-dynamic-theme-${version}\*" -Destination $sp_dot_dir -Recurse -Force
Write-Done
# Installing.
Write-Part "INSTALLING ";
cd $sp_dot_dir
Copy-Item dribbblish.js ..\..\Extensions
Copy-Item dribbblish-dynamic.js ..\..\Extensions
Copy-Item Vibrant.min.js ..\..\Extensions
spicetify config extensions default-dynamic.js-
spicetify config extensions dribbblish-dynamic.js
spicetify config extensions dribbblish.js
spicetify config extensions Vibrant.min.js
spicetify config current_theme DribbblishDynamic
spicetify config inject_css 1 replace_colors 1 overwrite_assets 1
spicetify 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"
}