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

Commit f040e2f

Browse files
committed
Background service can be launched without restart
1 parent 9197ccb commit f040e2f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

main.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ def __init__(self):
5050
loadUi("res/manager.ui", self)
5151
print('Launching in debug mode...')
5252

53+
# Add task tray icon which makes menu window visible on click
54+
if (readConfig('Manager', 'watchwitch') == 'True'):
55+
self.tray = QSystemTrayIcon()
56+
menu = QMenu()
57+
self.tray.setContextMenu(menu)
58+
self.tray.activated.connect(self.showManagerWindow)
59+
self.tray.setIcon(QIcon(os.path.join(
60+
os.path.dirname(__file__), 'res', 'icon.png'
61+
)))
62+
self.tray.setVisible(True)
63+
5364
# Checks if file is run on startup
5465
if not "--startup" in sys.argv:
5566
self.InitWindow()
@@ -59,15 +70,6 @@ def __init__(self):
5970
self.InitWindow()
6071
self.show()
6172
self.hide()
62-
# Add task tray icon which makes menu window visible on click
63-
self.tray = QSystemTrayIcon()
64-
menu = QMenu()
65-
self.tray.setContextMenu(menu)
66-
self.tray.activated.connect(self.showManagerWindow)
67-
self.tray.setIcon(QIcon(os.path.join(
68-
os.path.dirname(__file__), 'res', 'icon.png'
69-
)))
70-
self.tray.setVisible(True)
7173

7274
self.bt_master.clicked.connect(self.masterButton)
7375
self.bt_uninstall.clicked.connect(self.startRemoval)
@@ -97,7 +99,7 @@ def showManagerWindow(self):
9799
# Ask user to keep manager in background
98100

99101
def closeEvent(self, event):
100-
if "--startup" in sys.argv:
102+
if self.isWatchWitchPatched:
101103
message_box = QMessageBox(self)
102104
message_box.setWindowTitle("Move to background")
103105
message_box.setText(
@@ -111,8 +113,6 @@ def closeEvent(self, event):
111113
self.hide()
112114
else:
113115
event.accept()
114-
else:
115-
event.accept()
116116

117117
#
118118
# Master trigger for all actions related to spicetify
@@ -280,7 +280,7 @@ def PatchWatchWitch(self):
280280
watchwitchInjector(self.check_watchwitch.isChecked())
281281
if not self.check_startonboot.isChecked() and self.check_watchwitch.isChecked():
282282
warnDialog(
283-
"Start on boot is not enabled! \nThe server will not start on boot!")
283+
"Start on boot is not enabled! \n This will only take effect when the the manager is running (or restart if you prefer this)")
284284

285285
# Auto close manager after completing actions (does not check for status!)
286286
def AutoClose(self):
@@ -294,9 +294,9 @@ def NeverRestart(self):
294294

295295
# Auto patch in background
296296
def AutoPatchInBackground(self):
297-
if self.check_autopatch.isChecked() and not (self.check_startonboot.isChecked() and self.check_watchwitch.isChecked()):
297+
if self.check_autopatch.isChecked() and not self.check_watchwitch.isChecked():
298298
warnDialog(
299-
"Start on boot and/or startup listener is not enabled! \n This option will have no effect without those options enabled!")
299+
"Start on boot and/or startup listener is not enabled! \n Detection will only work WITH the server!")
300300
writeConfig('Manager', 'autopatch', str(
301301
self.check_autopatch.isChecked()))
302302

res/manager.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ QPushButton:hover
566566
}</string>
567567
</property>
568568
<property name="text">
569-
<string>Spotify startup listener server on port 1738</string>
569+
<string>Spotify startup listener server on port 1738 (restart to activate)</string>
570570
</property>
571571
<property name="iconSize">
572572
<size>

0 commit comments

Comments
 (0)