diff --git a/PKGBUILD b/PKGBUILD index a25aa44..117ff7d 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Eric Lay pkgname=systrayupdater -pkgver=r47.a550ac3 +pkgver=r48.14267bc pkgrel=1 pkgdesc="PyQt5 system tray applet notifier of available updates" arch=('x86_64') @@ -26,5 +26,5 @@ package() { 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" + install -Dm644 icons/*.svg -t "$pkgdir/usr/share/icons/hicolor/symbolic/apps" } diff --git a/README.md b/README.md index dbb107d..9552dee 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ # systrayUpdater -PyQt5 system tray applet to notify of available updates. +PyQt5 system tray applet notifier of available updates. For Arch (based) systems only! Right click to access menu actions: - Run update - Read the News -- Display list of packages with updates available (click to search arch website for highlighted package) +- Display list of packages with updates available + - (click to find package on Arch linux Package Search website) To install: ``` @@ -15,11 +16,15 @@ cd systrayUpdater makepkg -sric ``` +Post install: +It is suggested to copy `/etc/systrayupdater` to `$HOME/.config/systrayupdater` + Uses config file for options: `/etc/systrayupdater/config.yml` -- Terminal command and option (usually `-e`) +- Terminal command (set to `$TERM` by default) +- Set terminal option (usually `-e`) - Timer duration for `checkupdates` to run in backgound - Custom system tray icon -- Override by copying file to `$HOME/systrayupdater/config.yml` +- Defaults to `$HOME/systrayupdater/config.yml` if found Includes: - .desktop file for autostarting diff --git a/config.yml b/config.yml index 99d9289..c0c0680 100644 --- a/config.yml +++ b/config.yml @@ -1,12 +1,10 @@ -# ----------------# # systrayUpdater # # ----------------# - # Terminal emulator launch command and execute option terminal: $TERM option: -e # timer value is set to minutes timer: 10 -# custom icons should follow Arch linux standards -# custom icons should be stored in ~/.config/systrayUpdater -icon: arch-white-symbolic-24.svg +# Icons can be set to pre-defined colors: red, purple, blue, green, yellow, white, gray and black +# Custom icons should be placed in "~/.config/systrayupdater" and file name provided +icon: white diff --git a/icons/arch-black-symbolic-24.svg b/icons/arch-black-symbolic-24.svg new file mode 100644 index 0000000..6efed3a --- /dev/null +++ b/icons/arch-black-symbolic-24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/arch-blue-symbolic-24.svg b/icons/arch-blue-symbolic-24.svg similarity index 100% rename from arch-blue-symbolic-24.svg rename to icons/arch-blue-symbolic-24.svg diff --git a/arch-blue-symbolic-80.svg b/icons/arch-blue-symbolic-80.svg similarity index 100% rename from arch-blue-symbolic-80.svg rename to icons/arch-blue-symbolic-80.svg diff --git a/icons/arch-gray-symbolic-24.svg b/icons/arch-gray-symbolic-24.svg new file mode 100644 index 0000000..061998f --- /dev/null +++ b/icons/arch-gray-symbolic-24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/arch-green-symbolic-24.svg b/icons/arch-green-symbolic-24.svg new file mode 100644 index 0000000..83241b5 --- /dev/null +++ b/icons/arch-green-symbolic-24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/arch-purple-symbolic-24.svg b/icons/arch-purple-symbolic-24.svg new file mode 100644 index 0000000..b96946a --- /dev/null +++ b/icons/arch-purple-symbolic-24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/arch-red-symbolic-24.svg b/icons/arch-red-symbolic-24.svg new file mode 100644 index 0000000..82b3cfd --- /dev/null +++ b/icons/arch-red-symbolic-24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/arch-white-symbolic-24.svg b/icons/arch-white-symbolic-24.svg similarity index 100% rename from arch-white-symbolic-24.svg rename to icons/arch-white-symbolic-24.svg diff --git a/icons/arch-yellow-symbolic-24.svg b/icons/arch-yellow-symbolic-24.svg new file mode 100644 index 0000000..c8bdeba --- /dev/null +++ b/icons/arch-yellow-symbolic-24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/systray-updater b/systray-updater index 9dbca3c..053395b 100755 --- a/systray-updater +++ b/systray-updater @@ -16,23 +16,48 @@ avail = "" outputList = "" # Use config.yml file to allow for compatibility with -# most terminal emulators possible & custom icon / timer duration +# most terminal emulators possible, custom timer duration and icons if path.exists(path.expanduser("~/.config/systrayupdater/config.yml")): config = path.expanduser("~/.config/systrayupdater/config.yml") else: - config = '/etc/systrayupdater/config.yml' + 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() +try: + f = open(config) +except FileNotFoundError: + print("No config file found\n") + sys.exit() +conf = yaml.load(f, yaml.FullLoader) +term = str(conf['terminal']) +opt = str(conf['option']) +wait = int(conf['timer']) * 60000 +icn = str(conf['icon']) +f.close() + +iconDir = '/usr/share/icons/hicolor/symbolic/apps/' +match icn: + case "white": + iconFile = path.join(iconDir, 'arch-white-symbolic-24.svg') + case "blue": + iconFile = path.join(iconDir, 'arch-blue-symbolic-24.svg') + case "red": + iconFile = path.join(iconDir, 'arch-red-symbolic-24.svg') + case "green": + iconFile = path.join(iconDir, 'arch-green-symbolic-24.svg') + case "purple": + iconFile = path.join(iconDir, 'arch-purple-symbolic-24.svg') + case "yellow": + iconFile = path.join(iconDir, 'arch-yellow-symbolic-24.svg') + case "black": + iconFile = path.join(iconDir, 'arch-black-symbolic-24.svg') + case "gray": + iconFile = path.join(iconDir, 'arch-gray-symbolic-24.svg') + case _: + iconFile = path.join(path.expanduser("~/.config/systrayupdater/"), icn) # Run checkupdates command # Populates the available updates and count -# Sets the list and count in proper spots +# Sets the menu options, list and count in proper spots def count(): cmd = ['checkupdates'] p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE) @@ -54,7 +79,6 @@ def count(): tray.setVisible(True) # Read the News -# Get pkg info def news(): url = 'https://archlinux.org/news/' webbrowser.open_new_tab(url) @@ -65,7 +89,7 @@ def infos(pkgString): url = 'https://archlinux.org/packages/?q='+ pkg[0] webbrowser.open_new_tab(url) -# Run system updatehttps://archlinux.org/packages/?q='+ pkg[0] +# Run system update def update(): cmd = [ term, opt, 'sudo', 'pacman', '-Syu' ] subprocess.Popen(cmd) @@ -83,7 +107,7 @@ updateTimer.start(wait) # Adding items to the tray tray = QSystemTrayIcon() -icon = QIcon(icn) +icon = QIcon(iconFile) tray.setIcon(icon) tray.setToolTip(avail) tray.setVisible(True)