Skip to content

Commit

Permalink
Background window management workarround
Browse files Browse the repository at this point in the history
  • Loading branch information
Protonosgit committed Dec 9, 2023
1 parent 555b5c2 commit b6b957f
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from components.dialog_windows import AfterInstall
from werkzeug.wrappers import Request, Response
from werkzeug.serving import run_simple
from windows_toasts import ToastActivatedEventArgs
from windows_toasts import ToastActivatedEventArgs, WindowsToaster, Toast, ToastButton, InteractableWindowsToaster

initConfig()

Expand Down Expand Up @@ -47,10 +47,13 @@ def __init__(self):
print('Launching in debug mode...')

if not "--startup" in sys.argv:
# if "--startup" in sys.argv:
self.InitWindow()
self.show()

else:
self.InitWindow()
self.show()
self.hide()
# Add task tray icon which makes menu window visible on click
self.tray = QSystemTrayIcon()
menu = QMenu()
Expand All @@ -60,7 +63,6 @@ def __init__(self):
os.path.dirname(__file__), 'res', 'icon.png'
)))
self.tray.setVisible(True)
# Check if window is visible and toggle visibility

self.bt_master.clicked.connect(self.masterButton)
self.bt_uninstall.clicked.connect(self.startRemoval)
Expand Down Expand Up @@ -449,19 +451,29 @@ def run(self):
# Checks if spicetify is ok


newToast = Toast(['Spicetify Manager'])
newToast.AddAction(ToastButton('Open Manager', 'response=manager'))


def alertSpicetifyStatus():
status = spicetifyStatusCheck()
if status == 2:
spicetifyStatusToast(
'A new version of Spicetify is available').on_activated = toast_callback
if status == 0:
print("A new version of Spicetify is available")
interactableToaster = InteractableWindowsToaster(
'An update for spicetify is available')
interactableToaster.show_toast(newToast)
elif status == 1:
spicetifyStatusToast(
'Spicetify is not working correctly').on_activated = toast_callback
print("Spicetify is not working correctly")
interactableToaster = InteractableWindowsToaster(
'Spicetify is not working correctly')
interactableToaster.show_toast(newToast)


def activated_callback(activatedEventArgs: ToastActivatedEventArgs):
manager.show()

def toast_callback(activatedEventArgs: ToastActivatedEventArgs):
print('For some f***ing reason this is not working pls help')

newToast.on_activated = activated_callback

# start the app
manager = None
Expand Down

0 comments on commit b6b957f

Please sign in to comment.