Skip to content

Commit

Permalink
Copilot button will show automatically to users who have the copilot …
Browse files Browse the repository at this point in the history
…button on the taskbar
  • Loading branch information
marticliment committed Jul 24, 2024
1 parent 849f2a5 commit c3eb97b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions elevenclock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def updateIfPossible(force = False):
with open(os.path.join(tempDir, "elevenclock-updater.exe"), 'wb') as f:
f.write(datatowrite)
filename = f.name
if(hashlib.sha256(datatowrite).hexdigest().lower() == provided_hash):
if hashlib.sha256(datatowrite).hexdigest().lower() == provided_hash:
print("🔵 Hash: ", provided_hash)
print("🟢 Hash ok, starting update")
if(getSettings("EnableSilentUpdates") and not(force)):
Expand Down Expand Up @@ -908,7 +908,7 @@ def __init__(self, dpix: float, dpiy: float, screen: QScreen, index: int, isCove


self.CopilotButton: CopilotButton = None
if(not self.IS_COVER and getSettings("EnableCopilotIcon")):
if not self.IS_COVER and IsCopilotEnabled():
self.CopilotButton = CopilotButton(self)
self.CopilotButton.setFixedHeight(self.preferedHeight)
self.CopilotButton.setFixedWidth(40)
Expand Down Expand Up @@ -1127,7 +1127,7 @@ def checkAndUpdateBackground(self) -> None:

if ENABLE_AUTOMATIC_BACKGROUND_COLOR or ENABLE_AUTOMATIC_TEXT_COLOR:
screen = self.screen().geometry()
BackgroundIntegerColor = self.screen().grabWindow(0, self.x() - screen.x() + self.label.x() + (self.label.width() + 1 if self.CLOCK_ON_THE_LEFT else - 1), self.y()-screen.y(), 1, 1).toImage().pixel(0, 0)
BackgroundIntegerColor = self.screen().grabWindow(0, self.x() - screen.x() + self.label.x() + (self.label.width() + 1 if self.CLOCK_ON_THE_LEFT else - 2), self.y()-screen.y(), 1, 1).toImage().pixel(0, 0)


if globals.trayIcon:
Expand Down
5 changes: 4 additions & 1 deletion elevenclock/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def readRegedit(aKey, sKey, default, storage=winreg.HKEY_CURRENT_USER):
return default


def IsCopilotEnabled():
return readRegedit(r"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCopilotButton", 0) == 1 ^ getSettings("EnableCopilotIcon")

if winver == 22621:
if readRegedit(r"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR", 0, winreg.HKEY_LOCAL_MACHINE) >= 2361:
isMoment4 = True
Expand Down Expand Up @@ -628,7 +631,7 @@ def execMenu(self, pos: QPoint, clockInstance: '__init__.Clock'):

if clockInstance:
self.enableCopilot.setEnabled(True)
self.enableCopilot.setText(_("Enable Copilot button") if not getSettings("EnableCopilotIcon") else _("Disable Copilot button"))
self.enableCopilot.setText(_("Enable Copilot button") if not IsCopilotEnabled() else _("Disable Copilot button"))
else:
self.enableCopilot.setEnabled(False)

Expand Down

0 comments on commit c3eb97b

Please sign in to comment.