WIP
This commit is contained in:
parent
31d6d39552
commit
e39ed37766
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue