Skip to content

Commit

Permalink
Add sleep times to prevent CPU clogging
Browse files Browse the repository at this point in the history
  • Loading branch information
vorlie committed Aug 15, 2024
1 parent 8ebb9a8 commit 55ed8b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import qdarktheme as qdt, sys, json, platform, logging
import utils, darkdetect
from time import sleep
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QObject, QThread, pyqtSignal
from core.musicPlayer import MusicPlayer
Expand Down Expand Up @@ -41,6 +42,7 @@ def run(self):
if new_theme != self.current_theme:
self.current_theme = new_theme
self.on_theme_change(new_theme)
sleep(5)

def on_theme_change(self, theme):
logging.info(f"Detected theme change: {theme}")
Expand Down
4 changes: 3 additions & 1 deletion utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import ctypes
import ctypes.wintypes
import darkdetect
from time import sleep
from winreg import HKEY_CURRENT_USER, QueryValueEx, OpenKey

advapi32 = ctypes.windll.advapi32
Expand Down Expand Up @@ -148,4 +149,5 @@ def listener(callback):
light_alt = lighten_color(accent, colorValues['light_alt'])

# Call the callback with the system theme and colors
callback(accent, dark, dark_alt, light, light_alt)
callback(accent, dark, dark_alt, light, light_alt)
sleep(5)

1 comment on commit 55ed8b7

@vorlie
Copy link
Owner Author

@vorlie vorlie commented on 55ed8b7 Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not notice that until now lol..

Please sign in to comment.