From 0f89ad2600750a915878fc3fba01c5e28cc511d5 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Tue, 1 Oct 2024 11:08:02 +0200 Subject: [PATCH] feat: Add a right click menu entry to trigger a check for updates in the systray applet (#258) Add a right click menu entry to check for updates in the systray applet (runs `arch-update --check`), allowing to easily trigger a check for new pending updates without having to actually run `arch-update` by cliking systray or waiting for the systemd timer to pass (or without having to run `arch-update --check` manually via the terminal) --- po/arch-update.pot | 8 ++++++-- po/fr.po | 8 ++++++-- src/lib/tray.py | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/po/arch-update.pot b/po/arch-update.pot index 4de7dcd..5535b21 100644 --- a/po/arch-update.pot +++ b/po/arch-update.pot @@ -588,11 +588,15 @@ msgstr "" msgid "No service requiring a post upgrade restart found\\n" msgstr "" -#: src/lib/tray.py:123 +#: src/lib/tray.py:127 msgid "Run Arch-Update" msgstr "" -#: src/lib/tray.py:124 +#: src/lib/tray.py:128 +msgid "Check for updates" +msgstr "" + +#: src/lib/tray.py:129 msgid "Exit" msgstr "" diff --git a/po/fr.po b/po/fr.po index 71dcba9..dde3e4b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -658,11 +658,15 @@ msgstr "" msgid "No service requiring a post upgrade restart found\\n" msgstr "Aucun service nécessitant un redémarrage suite à la mise à jour n'a été trouvé\\n" -#: src/lib/tray.py:123 +#: src/lib/tray.py:127 msgid "Run Arch-Update" msgstr "Lancer Arch-Update" -#: src/lib/tray.py:124 +#: src/lib/tray.py:128 +msgid "Check for updates" +msgstr "Vérifier les mises à jour" + +#: src/lib/tray.py:129 msgid "Exit" msgstr "Quitter" diff --git a/src/lib/tray.py b/src/lib/tray.py index dbad83f..8c62443 100755 --- a/src/lib/tray.py +++ b/src/lib/tray.py @@ -98,6 +98,10 @@ def run(self): """ Start arch-update """ arch_update() + def check(self): + """ Check for updates """ + subprocess.run(["arch-update", "--check"], check=False) + def exit(self): """ Close systray process """ sys.exit(0) @@ -121,11 +125,14 @@ def __init__(self, iconfile): # Menu menu = QMenu() menu_launch = QAction(_("Run Arch-Update")) + menu_check = QAction(_("Check for updates")) menu_exit = QAction(_("Exit")) menu.addAction(menu_launch) + menu.addAction(menu_check) menu.addAction(menu_exit) menu_launch.triggered.connect(self.run) + menu_check.triggered.connect(self.check) menu_exit.triggered.connect(self.exit) self.tray.setContextMenu(menu)