mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 03:34:15 +02:00
System updates notification and env vars
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
from PyQt5.QtCore import QThread, pyqtSignal, QCoreApplication
|
||||
@@ -6,7 +7,6 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
|
||||
|
||||
from core import resource
|
||||
|
||||
|
||||
# to update
|
||||
from core.controller import FlatpakController
|
||||
from view.qt.window import ManageWindow
|
||||
@@ -57,12 +57,18 @@ class TrayIcon(QSystemTrayIcon):
|
||||
|
||||
def notify_updates(self, updates: int):
|
||||
if updates > 0:
|
||||
if self.icon() != self.icon_update:
|
||||
if self.icon().cacheKey() != self.icon_update.cacheKey():
|
||||
self.setIcon(self.icon_update)
|
||||
self.setToolTip('Updates found: {}'.format(updates))
|
||||
|
||||
if self.manage_window:
|
||||
msg = 'Updates found: {}'.format(updates)
|
||||
self.setToolTip(msg)
|
||||
|
||||
if bool(os.getenv('FPAKMAN_UPDATE_NOTIFICATION', 1)):
|
||||
os.system("notify-send -i {} '{}'".format(resource.get_path('img/flathub_10.svg'), msg))
|
||||
|
||||
if self.manage_window and not self.manage_window.isHidden():
|
||||
self.manage_window.refresh()
|
||||
|
||||
else:
|
||||
self.setIcon(self.icon_default)
|
||||
self.setToolTip(None)
|
||||
|
||||
Reference in New Issue
Block a user