From 2b8fc862422a381a845b62a6579c38c4be3362c4 Mon Sep 17 00:00:00 2001 From: Eric Lay Date: Sat, 9 Dec 2023 11:50:24 -0600 Subject: [PATCH] minor syntax --- PKGBUILD | 4 ++-- README.md | 2 +- systray-updater | 32 ++++++++++++++------------------ systrayupdater.desktop | 2 +- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 93ec421..3f0fc67 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -9,8 +9,8 @@ license=('GPL3') depends=('python' 'python-pyqt5' 'python-yaml' - 'hicolor-icon-theme' - 'pacman') + 'pacman-contrib' + 'hicolor-icon-theme') makedepends=('git') optdepends=() source=("git+https://github.com/ericlay/$pkgname.git") diff --git a/README.md b/README.md index 9552dee..4b163ea 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# systrayUpdater +# systrayUpdater 󱉛 PyQt5 system tray applet notifier of available updates. For Arch (based) systems only! diff --git a/systray-updater b/systray-updater index bbb9583..bd57eb6 100755 --- a/systray-updater +++ b/systray-updater @@ -27,7 +27,7 @@ try: except FileNotFoundError: print("No config file found\n") sys.exit() -conf = yaml.load(f, yaml.FullLoader) +conf = yaml.load(f,yaml.FullLoader) term = str(conf['terminal']) opt = str(conf['option']) wait = int(conf['timer']) * 60000 @@ -37,30 +37,30 @@ f.close() iconDir = '/usr/share/icons/hicolor/symbolic/apps/' match icn: case "white": - icon = QIcon(path.join(iconDir, 'arch-white-symbolic-24.svg')) + icon = QIcon(path.join(iconDir,'arch-white-symbolic-24.svg')) case "blue": - icon = QIcon(path.join(iconDir, 'arch-blue-symbolic-24.svg')) + icon = QIcon(path.join(iconDir,'arch-blue-symbolic-24.svg')) case "red": - icon = QIcon(path.join(iconDir, 'arch-red-symbolic-24.svg')) + icon = QIcon(path.join(iconDir,'arch-red-symbolic-24.svg')) case "green": - icon = QIcon(path.join(iconDir, 'arch-green-symbolic-24.svg')) + icon = QIcon(path.join(iconDir,'arch-green-symbolic-24.svg')) case "purple": - icon = QIcon(path.join(iconDir, 'arch-purple-symbolic-24.svg')) + icon = QIcon(path.join(iconDir,'arch-purple-symbolic-24.svg')) case "yellow": - icon = QIcon(path.join(iconDir, 'arch-yellow-symbolic-24.svg')) + icon = QIcon(path.join(iconDir,'arch-yellow-symbolic-24.svg')) case "black": - icon = QIcon(path.join(iconDir, 'arch-black-symbolic-24.svg')) + icon = QIcon(path.join(iconDir,'arch-black-symbolic-24.svg')) case "gray": - icon = QIcon(path.join(iconDir, 'arch-gray-symbolic-24.svg')) + icon = QIcon(path.join(iconDir,'arch-gray-symbolic-24.svg')) case _: - icon = QIcon(path.join(path.expanduser("~/.config/systrayupdater/"), icn)) + icon = QIcon(path.join(path.expanduser("~/.config/systrayupdater/"),icn)) # Run checkupdates command # Populates the available updates and count # Sets the menu options, list and count in proper spots def count(): cmd = ['checkupdates'] - p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE) + p1 = subprocess.Popen(cmd,stdout=subprocess.PIPE) global outputList outputList = ((p1.communicate()[0]).decode()).rstrip('\n') outputCount = len(outputList.splitlines()) @@ -105,12 +105,6 @@ updateTimer.timeout.connect(count) updateTimer.singleShot(1,count) # Initially populate available updates updateTimer.start(wait) -# Adding items to the tray -tray = QSystemTrayIcon() -tray.setIcon(icon) -tray.setToolTip(avail) -tray.setVisible(True) - # Creating the menu/options menu = QMenu() runUpdate = QAction("Run Update") @@ -120,7 +114,9 @@ runUpdate.triggered.connect(update) readNews.triggered.connect(news) quit.triggered.connect(app.quit) -# Place the menu in the System Tray +# Create applet and place menu in it +tray = QSystemTrayIcon() +tray.setIcon(icon) tray.setContextMenu(menu) app.exec_() diff --git a/systrayupdater.desktop b/systrayupdater.desktop index 0b597b9..aa44d2b 100644 --- a/systrayupdater.desktop +++ b/systrayupdater.desktop @@ -2,7 +2,7 @@ Version=1.0 Type=Application Name=SysTrayUpdater -Exec=/usr/bin/systrayUpdater +Exec=/usr/bin/systray-updater Icon=/usr/share/icons/hicolor/symbolic/arch-blue-symbolic-80.svg Terminal=false StartupNotify=false