Skip to content

Commit

Permalink
Fixed notification behavior when using the system tray.
Browse files Browse the repository at this point in the history
  • Loading branch information
N0tACyb0rg committed May 11, 2024
1 parent 13228ca commit 94ceba0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/variamain.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def __init__(self, variaapp, appdir, appconf, aria2c_subprocess, aria2cexec, *ar
qt_widgets = importlib.util.find_spec("PyQt6.QtWidgets")
self.hasqt = qt_gui is not None and qt_widgets is not None

self.nudged = False

# Fix config if PyQt6 does not exist and the tray is enabled in the config:
if not self.hasqt and self.appconf["use_tray"] == "tray":
self.appconf["use_tray"] = "none"
Expand Down Expand Up @@ -322,10 +324,12 @@ def exitProgram(self, app, variaapp, background):
self.tray.set_state(False)
except AttributeError:
pass
notification = Gio.Notification.new(_("Background Mode"))
notification.set_body(_("Continuing the downloads in the background."))
notification.set_title(_("Background Mode")),
variaapp.send_notification(None, notification)
if not self.nudged:
notification = Gio.Notification.new(_("Background Mode"))
notification.set_body(_("Continuing the downloads in the background."))
notification.set_title(_("Background Mode")),
variaapp.send_notification(None, notification)
self.nudged = True
print('Background mode')
else:
self.terminating = True
Expand Down

0 comments on commit 94ceba0

Please sign in to comment.