This commit is contained in:
airclay 2021-09-04 21:12:08 -05:00
parent 31d6d39552
commit e39ed37766
2 changed files with 15 additions and 0 deletions

View File

@ -17,6 +17,7 @@ with open(path.expanduser("~/.config/systrayUpdater/systrayUpdater.yml")) as f:
conf = yaml.load(f, yaml.FullLoader)
term = str(conf['terminal'])
opt = str(conf['option'])
cache = str(conf['cache']).capitalize()
wait = int(conf['timer']) * 60000
icn = path.join(path.expanduser("~/.config/systrayUpdater/"), str(conf['icon']))
f.close()
@ -31,6 +32,11 @@ def count():
global avail
avail = str(output)+" Updates"
# Download pkg's to cache
def cacheUpdates():
cmd = ['checkupdates', '-d']
subprocess.cmd(cmd)
# Run system update
def update():
cmd = [ term, opt, 'sudo', 'pacman', '-Syu']
@ -45,6 +51,10 @@ def newText():
# Initially populate available updates
count()
# Download pkg's to cache
if cache == True:
cacheUpdates()
app = QApplication([])
app.setQuitOnLastWindowClosed(False)
@ -67,6 +77,8 @@ menu.addAction(option1)
# Set up timer to update count
timer = QTimer()
timer.timeout.connect(newText)
# Download pkg's to cache on timeout
timer.timeout.connect(cacheUpdates)
timer.start(wait)
# To quit the app

View File

@ -10,3 +10,6 @@ timer: 10
# custom icons should follow Arch linux standards
# custom icons should be stored in ~/.config/systrayUpdater
icon: white-logo.png
# If you would like to automatically download pkg's to cache
# uses 'checkupdates -d' in background
cache: true