Skip to content
This repository was archived by the owner on Aug 8, 2025. It is now read-only.

Commit aa98fd9

Browse files
committed
Added ability to launch Spotify from patcher and function to check if spicetify is applied
1 parent c3ec624 commit aa98fd9

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

components/shellbridge.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
import os
23
import subprocess
34
from PyQt6.QtCore import Qt, QThread, pyqtSignal
45
import requests
@@ -8,17 +9,25 @@ class InstallSpicetify(QThread):
89
finished_signal = pyqtSignal()
910
def run(self):
1011
try:
11-
self.progress_signal.emit("Downloading Spicetify...")
12-
subprocess.run('iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1 | iex' ,check=True)
13-
self.progress_signal.emit("Creating backup...")
14-
subprocess.run('spicetify clear',check=True)
15-
subprocess.run('spicetify backup',check=True)
16-
self.progress_signal.emit("Activating Spicetify...")
17-
#subprocess.run('powershell.exe -Command "spicetify apply"',check=True)
18-
self.progress_signal.emit("Installing Marketplace...")
19-
subprocess.run('Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1" | Invoke-Expression' ,check=True)
20-
except:
12+
if sys.platform == 'win32':
13+
self.progress_signal.emit("Downloading Spicetify...")
14+
subprocess.run('powershell.exe -Command "iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1 | iex"',check=True)
15+
self.progress_signal.emit("Creating backup...")
16+
subprocess.run('spicetify clear',check=True)
17+
subprocess.run('spicetify backup apply enable-devtools',check=True)
18+
self.progress_signal.emit("Installing Marketplace...")
19+
subprocess.run('powershell.exe -Command "iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1 | iex"',check=True)
20+
else:
21+
self.progress_signal.emit("Downloading Spicetify...")
22+
subprocess.run('curl -fsSL https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.sh | sh',check=True)
23+
self.progress_signal.emit("Creating backup...")
24+
subprocess.run('spicetify clear',check=True)
25+
subprocess.run('spicetify backup apply enable-devtools',check=True)
26+
self.progress_signal.emit("Installing Marketplace...")
27+
subprocess.run('curl -fsSL https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.sh | sh',check=True)
28+
except Exception as e:
2129
print("Error detected!")
30+
print(e)
2231
self.progress_signal.emit("fail")
2332
self.finished_signal.emit()
2433
class UpdateSpicetify(QThread):
@@ -49,4 +58,11 @@ def getLatestRelease():
4958
tag_name = latest_release["tag_name"]
5059
return tag_name
5160
else:
52-
return None
61+
return None
62+
63+
def checkApplied():
64+
folder_path = os.path.join( os.path.expanduser('~'), 'AppData','Roaming/Spotify/Apps/xpui')
65+
if os.path.exists(folder_path) and os.path.isdir(folder_path):
66+
return True
67+
else:
68+
return False

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from PyQt6.QtWidgets import QApplication, QDialog
2+
from PyQt6.QtWidgets import QApplication
33
from PyQt6.QtCore import Qt, QTimer
44
from splash_window import Splash
55
from menu_window import Menu

manager_window.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
from components.shellbridge import InstallSpicetify, UpdateSpicetify, UninstallSpicetify, getLatestRelease
88

99

10+
1011
class Manager(QMainWindow):
1112
def __init__(self):
1213
super().__init__()
14+
self.installmode = True
1315
loadUi('./res/manager.ui', self)
1416

1517
self.bt_install.clicked.connect(self.startInstaller)
@@ -44,6 +46,8 @@ def startInstaller(self):
4446
self.iprocess.finished_signal.connect(self.setup_finished)
4547
self.iprocess.progress_signal.connect(self.progressmaster)
4648
self.iprocess.start()
49+
def launchSpotify(self):
50+
os.startfile(os.path.join( os.path.expanduser('~'), 'AppData','Roaming/Spotify/Spotify.exe'))
4751
def startRemoval(self):
4852
self.setCursor(Qt.CursorShape.WaitCursor)
4953
self.bt_uninstall.setEnabled(False)
@@ -94,17 +98,28 @@ def checkSpicetify(self):
9498
self.l_status.setText("Spicetify is installed")
9599
self.l_status.setStyleSheet("color: green")
96100
versionoutput = subprocess.check_output('spicetify --version',shell=True)
97-
self.l_versioninfo.setText(versionoutput.decode("utf-8"))
101+
self.l_versioninfo.setText('Version: '+versionoutput.decode("utf-8"))
98102
self.bt_uninstall.setEnabled(True)
99103
self.bt_update.setEnabled(True)
100-
self.bt_install.setEnabled(False)
104+
self.bt_install.setEnabled(True)
105+
if self.installmode:
106+
self.installmode = False
107+
self.bt_install.setText("Launch Spotify")
108+
self.bt_install.clicked.disconnect(self.startInstaller)
109+
self.bt_install.clicked.connect(self.launchSpotify)
101110
else:
102111
self.l_status.setText("Spicetify is not installed")
103112
self.l_status.setStyleSheet("color: red")
104113
self.l_versioninfo.setText("")
105114
self.bt_uninstall.setEnabled(False)
106115
self.bt_update.setEnabled(False)
107116
self.bt_install.setEnabled(True)
108-
except:
117+
if not self.installmode:
118+
self.installmode = True
119+
self.bt_install.setText("Install")
120+
self.bt_install.clicked.disconnect(self.launchSpotify)
121+
self.bt_install.clicked.connect(self.startInstaller)
122+
except Exception as e:
109123
print("E: Error while checking Spicetify!")
124+
print(e)
110125
self.l_status.setText("Spicetify is not installed")

res/manager.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ border-bottom: none;
182182
}
183183
QPushButton:hover:!pressed
184184
{
185-
border: 1px solid #7749F8;
185+
border: 1px solid white;
186186
}
187187
QPushButton:pressed
188188
{

0 commit comments

Comments
 (0)