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

Commit 9b58f7c

Browse files
committed
Split start on boot and watchwitch and fixed checkbox glitches
1 parent a270f9d commit 9b58f7c

File tree

3 files changed

+65
-32
lines changed

3 files changed

+65
-32
lines changed

components/statusInfo.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def checkSpotifyRunning():
5050
return False
5151

5252

53-
def checkWatchWitch():
53+
def checkWatchWitchPatched():
5454
try:
5555
witchpath = os.path.join(os.path.join(os.path.expanduser(
5656
'~'), 'AppData', 'Roaming'), 'Spotify', 'Apps', 'xpui', 'index.html')
@@ -65,18 +65,17 @@ def checkWatchWitch():
6565
return False
6666

6767

68-
def isManagerOnBoot():
68+
def isAddedToStartup():
6969
try:
7070
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
7171
"Software\Microsoft\Windows\CurrentVersion\Run", 0, winreg.KEY_READ)
72-
_, value, _ = winreg.QueryValueEx(key, "SpicetifyManager")
72+
value, regtype = winreg.QueryValueEx(key, "SpicetifyManager")
7373
winreg.CloseKey(key)
7474
return True
7575
except FileNotFoundError:
7676
return False
7777
except Exception as e:
78-
print("Error while checking if added to startup")
79-
print(e)
78+
print(f"An error occurred: {e}")
8079
return False
8180

8281

main.py

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from PyQt6.QtCore import Qt, QUrl, QThread
99
from PyQt6.uic import loadUi
1010
from PyQt6.QtGui import QDesktopServices, QMovie, QIcon
11-
from components.popups import errorDialog, infoDialog, windowsToast, confirmationModal, spicetifyStatusToast
11+
from components.popups import errorDialog, warnDialog, windowsToast, confirmationModal, spicetifyStatusToast
1212
from components.shellbridge import InstallSpicetify, UpdateSpicetify, ApplySpicetify, UninstallSpicetify, CustomCommand, blockSpotifyUpdate
1313
from components.statusInfo import *
1414
from components.tools import *
@@ -31,7 +31,8 @@ def __init__(self):
3131
self.isApplied = False
3232
self.isActive = False
3333
self.isMarketInstalled = False
34-
self.isWatchWitched = False
34+
self.isWatchWitchPatched = False
35+
self.isRunningOnBoot = False
3536
self.isAutoClosing = False
3637
self.managermode = 0
3738

@@ -70,6 +71,7 @@ def __init__(self):
7071
self.check_noupdate.stateChanged.connect(self.DisableUpdate)
7172
self.check_watchwitch.stateChanged.connect(self.PatchWatchWitch)
7273
self.check_autoclose.stateChanged.connect(self.AutoClose)
74+
self.check_startonboot.stateChanged.connect(self.startOnBoot)
7375

7476
# Execute once window is loaded before listeners are enabled
7577

@@ -81,6 +83,7 @@ def InitWindow(self):
8183
self.background_graphics.show()
8284
movie.start()
8385

86+
# Display manager window
8487
def showManagerWindow(self):
8588
self.InitWindow()
8689
self.show()
@@ -255,28 +258,32 @@ def DisableUpdate(self):
255258
pass
256259
windowsToast("Update supression updated", "")
257260

258-
# Apply Watchwitch server
261+
# Enable Watchwitch server
259262
def PatchWatchWitch(self):
260-
folder_path = os.path.join(os.path.join(os.path.expanduser(
263+
writeConfig('Manager', 'watchwitch', str(
264+
self.check_watchwitch.isChecked()))
265+
watchwitchInjector(self.check_watchwitch.isChecked())
266+
if not self.check_startonboot.isChecked() and self.check_watchwitch.isChecked():
267+
warnDialog(
268+
"Start on boot is not enabled! \nThe server will not start on boot!")
269+
270+
# Auto close manager after completing actions (does not check for status!)
271+
def AutoClose(self):
272+
writeConfig('Manager', 'autoclose', str(
273+
self.check_autoclose.isChecked()))
274+
275+
# Start on boot
276+
def startOnBoot(self):
277+
managerpath = os.path.join(os.path.join(os.path.expanduser(
261278
'~'), 'AppData', 'Local'), 'spicetify', 'Manager.exe')
262-
if os.path.exists(folder_path):
263-
writeConfig('Manager', 'watchwitch', str(
264-
self.check_watchwitch.isChecked()))
265-
watchwitchInjector(self.check_watchwitch.isChecked())
266-
addToStartup(self.check_watchwitch.isChecked())
267-
else:
268-
self.check_watchwitch.setChecked(False)
279+
addToStartup(self.check_startonboot.isChecked())
280+
if not os.path.exists(managerpath):
269281
folder_path = os.path.join(os.path.join(
270282
os.path.expanduser('~'), 'AppData', 'Local'), 'spicetify')
271283
reply = confirmationModal(
272-
'Executeable not found', 'Please put the manager executeable in the "localappdata/spicetify/Manager.exe" folder! \n Do you want to open the folder?')
284+
'Executeable not found', 'Please put the manager executeable in the "localappdata/spicetify/Manager.exe" folder or else the manager will not start! \n Do you want to open the folder?')
273285
if reply == QMessageBox.StandardButton.Yes:
274286
os.startfile(folder_path)
275-
# Auto close manager after completing actions (does not check for status!)
276-
277-
def AutoClose(self):
278-
writeConfig('Manager', 'autoclose', str(
279-
self.check_autoclose.isChecked()))
280287

281288
# Called when spicetify is installed or not
282289

@@ -323,13 +330,15 @@ def statusUpdate(self):
323330
'spicetify --version', shell=True).decode("utf-8").strip()
324331

325332
if self.isApplied:
326-
self.isWatchWitched = checkWatchWitch()
333+
self.isWatchWitchPatched = checkWatchWitchPatched()
327334

328335
if (readConfig('Manager', 'autoclose') == 'True'):
329336
self.isAutoClosing = True
330337
else:
331338
self.isAutoClosing = False
332339

340+
self.isRunningOnBoot = isAddedToStartup()
341+
333342
except Exception as e:
334343
print('Error while checking spicetify status')
335344
print(e)
@@ -409,8 +418,9 @@ def uiUpdate(self):
409418
self.managermode = 1
410419

411420
self.check_noupdate.setChecked(checkUpdateSupression())
412-
self.check_watchwitch.setChecked(self.isWatchWitched)
421+
self.check_watchwitch.setChecked(self.isWatchWitchPatched)
413422
self.check_autoclose.setChecked(self.isAutoClosing)
423+
self.check_startonboot.setChecked(self.isRunningOnBoot)
414424

415425
def checkUpdateAvailable(self):
416426
if (managerUpdateCheck()):
@@ -448,7 +458,7 @@ def run(self):
448458

449459

450460
# Runs the server if enabled
451-
if (isManagerOnBoot()):
461+
if (readConfig('Manager', 'watchwitch') == 'True'):
452462
watchwitch = WerkzeugThread()
453463
watchwitch.start()
454464

res/manager.ui

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ QPushButton:hover
424424
<property name="geometry">
425425
<rect>
426426
<x>10</x>
427-
<y>240</y>
427+
<y>350</y>
428428
<width>781</width>
429429
<height>51</height>
430430
</rect>
@@ -509,8 +509,8 @@ QPushButton:hover
509509
<widget class="QLabel" name="section">
510510
<property name="geometry">
511511
<rect>
512-
<x>40</x>
513-
<y>210</y>
512+
<x>30</x>
513+
<y>320</y>
514514
<width>401</width>
515515
<height>20</height>
516516
</rect>
@@ -528,7 +528,7 @@ QPushButton:hover
528528
<property name="geometry">
529529
<rect>
530530
<x>20</x>
531-
<y>30</y>
531+
<y>20</y>
532532
<width>381</width>
533533
<height>31</height>
534534
</rect>
@@ -555,7 +555,7 @@ QPushButton:hover
555555
<property name="geometry">
556556
<rect>
557557
<x>20</x>
558-
<y>70</y>
558+
<y>100</y>
559559
<width>381</width>
560560
<height>31</height>
561561
</rect>
@@ -582,7 +582,7 @@ QPushButton:hover
582582
<property name="geometry">
583583
<rect>
584584
<x>20</x>
585-
<y>150</y>
585+
<y>180</y>
586586
<width>381</width>
587587
<height>31</height>
588588
</rect>
@@ -609,7 +609,7 @@ QPushButton:hover
609609
<property name="geometry">
610610
<rect>
611611
<x>20</x>
612-
<y>110</y>
612+
<y>140</y>
613613
<width>381</width>
614614
<height>31</height>
615615
</rect>
@@ -629,6 +629,30 @@ QPushButton:hover
629629
</size>
630630
</property>
631631
</widget>
632+
<widget class="QCheckBox" name="check_startonboot">
633+
<property name="geometry">
634+
<rect>
635+
<x>20</x>
636+
<y>60</y>
637+
<width>381</width>
638+
<height>31</height>
639+
</rect>
640+
</property>
641+
<property name="styleSheet">
642+
<string notr="true">QCheckBox:!enabled{
643+
color: rgba(255, 255, 255, 120);
644+
}</string>
645+
</property>
646+
<property name="text">
647+
<string>Start manager on boot</string>
648+
</property>
649+
<property name="iconSize">
650+
<size>
651+
<width>50</width>
652+
<height>50</height>
653+
</size>
654+
</property>
655+
</widget>
632656
</widget>
633657
<widget class="QWidget" name="tab_3">
634658
<attribute name="icon">

0 commit comments

Comments
 (0)