88from PyQt6 .QtCore import Qt , QUrl , QThread
99from PyQt6 .uic import loadUi
1010from 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
1212from components .shellbridge import InstallSpicetify , UpdateSpicetify , ApplySpicetify , UninstallSpicetify , CustomCommand , blockSpotifyUpdate
1313from components .statusInfo import *
1414from 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! \n The 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
0 commit comments