updated config handling

This commit is contained in:
Eric Lay 2023-12-09 10:00:14 -06:00
parent 14267bcd2c
commit b4cad83073
13 changed files with 57 additions and 24 deletions

View File

@ -1,6 +1,6 @@
# Maintainer: Eric Lay <ericlaytm@gmail.com>
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"
}

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,256,256" width="24px" height="24px"><g fill="#000000" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)"><path d="M14.3,19.414c0.216,-0.569 0.342,-1.218 0.342,-1.913c0,-2.129 -1.139,-3.86 -2.539,-3.86c-1.412,0 -2.55,1.731 -2.55,3.86c0,0.683 0.114,1.332 0.33,1.89c-4.657,0.49 -7.936,2.437 -9.268,3.313c2.243,-3.234 4.589,-7.025 6.831,-11.386c0.558,-1.082 1.082,-2.152 1.571,-3.199c0.193,0.125 0.387,0.262 0.603,0.399c1.002,0.626 1.936,0.968 2.619,1.15c-0.501,-0.376 -1.047,-0.831 -1.605,-1.389c-0.421,-0.421 -0.797,-0.843 -1.116,-1.253c0.945,-2.072 1.765,-4.065 2.482,-5.955c1.195,3.165 2.687,6.615 4.554,10.247c1.207,2.334 2.437,4.509 3.666,6.513c-0.353,-0.193 -0.74,-0.376 -1.15,-0.535c-0.706,-0.273 -1.366,-0.444 -1.936,-0.546c0.774,0.387 1.674,0.9 2.619,1.583c0.615,0.456 1.161,0.911 1.628,1.355c0.011,0.011 0.011,0.011 0.023,0.023c0.649,1.059 1.321,2.038 1.981,2.994c-1.309,-0.866 -4.531,-2.779 -9.085,-3.291z"></path></g></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,256,256" width="24px" height="24px"><g fill="#a8a7a7" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)"><path d="M14.3,19.414c0.216,-0.569 0.342,-1.218 0.342,-1.913c0,-2.129 -1.139,-3.86 -2.539,-3.86c-1.412,0 -2.55,1.731 -2.55,3.86c0,0.683 0.114,1.332 0.33,1.89c-4.657,0.49 -7.936,2.437 -9.268,3.313c2.243,-3.234 4.589,-7.025 6.831,-11.386c0.558,-1.082 1.082,-2.152 1.571,-3.199c0.193,0.125 0.387,0.262 0.603,0.399c1.002,0.626 1.936,0.968 2.619,1.15c-0.501,-0.376 -1.047,-0.831 -1.605,-1.389c-0.421,-0.421 -0.797,-0.843 -1.116,-1.253c0.945,-2.072 1.765,-4.065 2.482,-5.955c1.195,3.165 2.687,6.615 4.554,10.247c1.207,2.334 2.437,4.509 3.666,6.513c-0.353,-0.193 -0.74,-0.376 -1.15,-0.535c-0.706,-0.273 -1.366,-0.444 -1.936,-0.546c0.774,0.387 1.674,0.9 2.619,1.583c0.615,0.456 1.161,0.911 1.628,1.355c0.011,0.011 0.011,0.011 0.023,0.023c0.649,1.059 1.321,2.038 1.981,2.994c-1.309,-0.866 -4.531,-2.779 -9.085,-3.291z"></path></g></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,256,256" width="24px" height="24px"><g fill="#20c997" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)"><path d="M14.3,19.414c0.216,-0.569 0.342,-1.218 0.342,-1.913c0,-2.129 -1.139,-3.86 -2.539,-3.86c-1.412,0 -2.55,1.731 -2.55,3.86c0,0.683 0.114,1.332 0.33,1.89c-4.657,0.49 -7.936,2.437 -9.268,3.313c2.243,-3.234 4.589,-7.025 6.831,-11.386c0.558,-1.082 1.082,-2.152 1.571,-3.199c0.193,0.125 0.387,0.262 0.603,0.399c1.002,0.626 1.936,0.968 2.619,1.15c-0.501,-0.376 -1.047,-0.831 -1.605,-1.389c-0.421,-0.421 -0.797,-0.843 -1.116,-1.253c0.945,-2.072 1.765,-4.065 2.482,-5.955c1.195,3.165 2.687,6.615 4.554,10.247c1.207,2.334 2.437,4.509 3.666,6.513c-0.353,-0.193 -0.74,-0.376 -1.15,-0.535c-0.706,-0.273 -1.366,-0.444 -1.936,-0.546c0.774,0.387 1.674,0.9 2.619,1.583c0.615,0.456 1.161,0.911 1.628,1.355c0.011,0.011 0.011,0.011 0.023,0.023c0.649,1.059 1.321,2.038 1.981,2.994c-1.309,-0.866 -4.531,-2.779 -9.085,-3.291z"></path></g></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,256,256" width="24px" height="24px"><g fill="#cc5de8" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)"><path d="M14.3,19.414c0.216,-0.569 0.342,-1.218 0.342,-1.913c0,-2.129 -1.139,-3.86 -2.539,-3.86c-1.412,0 -2.55,1.731 -2.55,3.86c0,0.683 0.114,1.332 0.33,1.89c-4.657,0.49 -7.936,2.437 -9.268,3.313c2.243,-3.234 4.589,-7.025 6.831,-11.386c0.558,-1.082 1.082,-2.152 1.571,-3.199c0.193,0.125 0.387,0.262 0.603,0.399c1.002,0.626 1.936,0.968 2.619,1.15c-0.501,-0.376 -1.047,-0.831 -1.605,-1.389c-0.421,-0.421 -0.797,-0.843 -1.116,-1.253c0.945,-2.072 1.765,-4.065 2.482,-5.955c1.195,3.165 2.687,6.615 4.554,10.247c1.207,2.334 2.437,4.509 3.666,6.513c-0.353,-0.193 -0.74,-0.376 -1.15,-0.535c-0.706,-0.273 -1.366,-0.444 -1.936,-0.546c0.774,0.387 1.674,0.9 2.619,1.583c0.615,0.456 1.161,0.911 1.628,1.355c0.011,0.011 0.011,0.011 0.023,0.023c0.649,1.059 1.321,2.038 1.981,2.994c-1.309,-0.866 -4.531,-2.779 -9.085,-3.291z"></path></g></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,256,256" width="24px" height="24px"><g fill="#fa5252" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)"><path d="M14.3,19.414c0.216,-0.569 0.342,-1.218 0.342,-1.913c0,-2.129 -1.139,-3.86 -2.539,-3.86c-1.412,0 -2.55,1.731 -2.55,3.86c0,0.683 0.114,1.332 0.33,1.89c-4.657,0.49 -7.936,2.437 -9.268,3.313c2.243,-3.234 4.589,-7.025 6.831,-11.386c0.558,-1.082 1.082,-2.152 1.571,-3.199c0.193,0.125 0.387,0.262 0.603,0.399c1.002,0.626 1.936,0.968 2.619,1.15c-0.501,-0.376 -1.047,-0.831 -1.605,-1.389c-0.421,-0.421 -0.797,-0.843 -1.116,-1.253c0.945,-2.072 1.765,-4.065 2.482,-5.955c1.195,3.165 2.687,6.615 4.554,10.247c1.207,2.334 2.437,4.509 3.666,6.513c-0.353,-0.193 -0.74,-0.376 -1.15,-0.535c-0.706,-0.273 -1.366,-0.444 -1.936,-0.546c0.774,0.387 1.674,0.9 2.619,1.583c0.615,0.456 1.161,0.911 1.628,1.355c0.011,0.011 0.011,0.011 0.023,0.023c0.649,1.059 1.321,2.038 1.981,2.994c-1.309,-0.866 -4.531,-2.779 -9.085,-3.291z"></path></g></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,256,256" width="24px" height="24px"><g fill="#f8f05e" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)"><path d="M14.3,19.414c0.216,-0.569 0.342,-1.218 0.342,-1.913c0,-2.129 -1.139,-3.86 -2.539,-3.86c-1.412,0 -2.55,1.731 -2.55,3.86c0,0.683 0.114,1.332 0.33,1.89c-4.657,0.49 -7.936,2.437 -9.268,3.313c2.243,-3.234 4.589,-7.025 6.831,-11.386c0.558,-1.082 1.082,-2.152 1.571,-3.199c0.193,0.125 0.387,0.262 0.603,0.399c1.002,0.626 1.936,0.968 2.619,1.15c-0.501,-0.376 -1.047,-0.831 -1.605,-1.389c-0.421,-0.421 -0.797,-0.843 -1.116,-1.253c0.945,-2.072 1.765,-4.065 2.482,-5.955c1.195,3.165 2.687,6.615 4.554,10.247c1.207,2.334 2.437,4.509 3.666,6.513c-0.353,-0.193 -0.74,-0.376 -1.15,-0.535c-0.706,-0.273 -1.366,-0.444 -1.936,-0.546c0.774,0.387 1.674,0.9 2.619,1.583c0.615,0.456 1.161,0.911 1.628,1.355c0.011,0.011 0.011,0.011 0.023,0.023c0.649,1.059 1.321,2.038 1.981,2.994c-1.309,-0.866 -4.531,-2.779 -9.085,-3.291z"></path></g></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -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)