From 5c31115ade078a5ac4702c2f008f53749127e185 Mon Sep 17 00:00:00 2001 From: Eric Lay Date: Fri, 8 Dec 2023 22:46:04 -0600 Subject: [PATCH] updated pkgbuild --- PKGBUILD | 4 +- systrayupdater | 103 ------------------------------------------------- 2 files changed, 2 insertions(+), 105 deletions(-) delete mode 100755 systrayupdater diff --git a/PKGBUILD b/PKGBUILD index 7ea5e04..d20a86a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,5 +1,5 @@ # Maintainer: Eric Lay -pkgname=systrayupdate-notifier +pkgname=systrayupdater pkgver=r36.ba00462 pkgrel=1 pkgdesc="PyQt5 system tray applet notifier of available updates" @@ -23,7 +23,7 @@ pkgver(){ package() { cd "$srcdir/$pkgname" - install -Dm755 systrayupdater -t "$pkgdir/usr/bin" + install -Dm755 systray-updater -t "$pkgdir/usr/bin" install -Dm755 config.yml -t "$pkgdir/etc/$pkgname" install -Dm666 systrayupdater.desktop -t "$pkgdir/usr/share/applications" install -Dm644 ./*.svg -t "$pkgdir/usr/share/icons/hicolor/symbolic/apps" diff --git a/systrayupdater b/systrayupdater deleted file mode 100755 index 9dbca3c..0000000 --- a/systrayupdater +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python - -# Get needed modules -import yaml -import webbrowser -import subprocess -from os import path -from time import sleep -from functools import partial -from PyQt5.QtCore import QTimer -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * - -# Available Updates holders -avail = "" -outputList = "" - -# Use config.yml file to allow for compatibility with -# most terminal emulators possible & custom icon / timer duration -if path.exists(path.expanduser("~/.config/systrayupdater/config.yml")): - config = path.expanduser("~/.config/systrayupdater/config.yml") -else: - config = '/etc/systrayupdater/config.yml' - -with open(config) as f: - conf = yaml.load(f, yaml.FullLoader) - term = str(conf['terminal']) - opt = str(conf['option']) - wait = int(conf['timer']) * 60000 - icn = path.join('/usr/share/icons/hicolor/symbolic/apps/', str(conf['icon'])) - f.close() - -# Run checkupdates command -# Populates the available updates and count -# Sets the list and count in proper spots -def count(): - cmd = ['checkupdates'] - p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE) - global outputList - outputList = ((p1.communicate()[0]).decode()).rstrip('\n') - outputCount = len(outputList.splitlines()) - if outputCount == 0: - tray.setVisible(False) - else: - menu.clear() - menu.addAction(readNews) - menu.addAction(runUpdate) - menu.addAction(quit) - for i in outputList.splitlines(): - menu.addAction(i, partial(infos, i)) - global avail - avail = str(outputCount)+" Updates" - tray.setToolTip(avail) - tray.setVisible(True) - -# Read the News -# Get pkg info -def news(): - url = 'https://archlinux.org/news/' - webbrowser.open_new_tab(url) - -# Get pkg info -def infos(pkgString): - pkg = pkgString.split(' ') - url = 'https://archlinux.org/packages/?q='+ pkg[0] - webbrowser.open_new_tab(url) - -# Run system updatehttps://archlinux.org/packages/?q='+ pkg[0] -def update(): - cmd = [ term, opt, 'sudo', 'pacman', '-Syu' ] - subprocess.Popen(cmd) - count() - -# Create an app surface -app = QApplication([]) -app.setQuitOnLastWindowClosed(False) - -# Set up timer -updateTimer = QTimer() -updateTimer.timeout.connect(count) -updateTimer.singleShot(1,count) # Initially populate available updates -updateTimer.start(wait) - -# Adding items to the tray -tray = QSystemTrayIcon() -icon = QIcon(icn) -tray.setIcon(icon) -tray.setToolTip(avail) -tray.setVisible(True) - -# Creating the menu/options -menu = QMenu() -runUpdate = QAction("Run Update") -readNews = QAction("Read the News") -quit = QAction("Quit") -runUpdate.triggered.connect(update) -readNews.triggered.connect(news) -quit.triggered.connect(app.quit) - -# Place the menu in the System Tray -tray.setContextMenu(menu) - -app.exec_()