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

Commit d145441

Browse files
committed
Added custom commands
1 parent 6691406 commit d145441

File tree

4 files changed

+177
-114
lines changed

4 files changed

+177
-114
lines changed

components/shellbridge.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,30 @@ def run(self):
5353
subprocess.run('rm -rf ~/.spicetify')
5454
subprocess.run('rm -rf ~/.config/spicetify')
5555
self.finished_signal.emit()
56+
57+
# Custom command task
58+
class CustomCommand(QThread):
59+
def __init__(self, index):
60+
super().__init__()
61+
self.cmnumber = index
62+
63+
finished_signal = pyqtSignal()
64+
def run(self):
65+
commandList = [
66+
'spicetify backup',
67+
'spicetify clear',
68+
'spicetify apply',
69+
'spicetify update',
70+
'spicetify upgrade',
71+
'spicetify enable-devtools',
72+
'spicetify restore',
73+
'spicetify --version',
74+
]
75+
try:
76+
subprocess.run(commandList[self.cmnumber])
77+
except:
78+
print("Error while running custom command!")
79+
5680

5781
#Checks github for latest spicetify version
5882
def getLatestRelease():

manager_window.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from PyQt6.QtWidgets import QMainWindow, QErrorMessage
88
from PyQt6.QtCore import Qt
99
from PyQt6.uic import loadUi
10-
from components.shellbridge import InstallSpicetify, UpdateSpicetify, UninstallSpicetify, getLatestRelease,checkApplied,checkSpotifyRunning
10+
from components.shellbridge import InstallSpicetify, UpdateSpicetify, UninstallSpicetify, CustomCommand, getLatestRelease,checkApplied,checkSpotifyRunning
1111

1212
from components.afterinstall_popup import Popup
1313

@@ -25,6 +25,7 @@ def __init__(self):
2525
self.bt_install.clicked.connect(self.startInstaller)
2626
self.bt_update.clicked.connect(self.startUpdate)
2727
self.bt_uninstall.clicked.connect(self.startRemoval)
28+
self.bt_cmd.clicked.connect(self.Custom)
2829

2930
self.checkSpicetify()
3031

@@ -101,6 +102,12 @@ def startUpdate(self):
101102
except:
102103
print("E: Error while checking version during update!")
103104

105+
# Run custom commands
106+
def Custom(self):
107+
self.iprocess = CustomCommand(self.combo_cmd.currentIndex())
108+
self.iprocess.finished_signal.connect(self.uninstall_finished)
109+
self.iprocess.start()
110+
104111
#Called when spicetify is installed of case of failure?
105112
def setup_finished(self):
106113
self.checkSpicetify()

0 commit comments

Comments
 (0)