From e39ed377662e601404945609e0739800652619a2 Mon Sep 17 00:00:00 2001 From: airclay Date: Sat, 4 Sep 2021 21:12:08 -0500 Subject: [PATCH] WIP --- systrayUpdater | 12 ++++++++++++ systrayupdater.yml | 3 +++ 2 files changed, 15 insertions(+) diff --git a/systrayUpdater b/systrayUpdater index c90e466..b07b8c9 100755 --- a/systrayUpdater +++ b/systrayUpdater @@ -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 diff --git a/systrayupdater.yml b/systrayupdater.yml index 4882256..38ba100 100644 --- a/systrayupdater.yml +++ b/systrayupdater.yml @@ -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