minor syntax
This commit is contained in:
parent
b18f018d65
commit
2b8fc86242
4
PKGBUILD
4
PKGBUILD
|
@ -9,8 +9,8 @@ license=('GPL3')
|
||||||
depends=('python'
|
depends=('python'
|
||||||
'python-pyqt5'
|
'python-pyqt5'
|
||||||
'python-yaml'
|
'python-yaml'
|
||||||
'hicolor-icon-theme'
|
'pacman-contrib'
|
||||||
'pacman')
|
'hicolor-icon-theme')
|
||||||
makedepends=('git')
|
makedepends=('git')
|
||||||
optdepends=()
|
optdepends=()
|
||||||
source=("git+https://github.com/ericlay/$pkgname.git")
|
source=("git+https://github.com/ericlay/$pkgname.git")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# systrayUpdater
|
# systrayUpdater
|
||||||
PyQt5 system tray applet notifier of available updates.
|
PyQt5 system tray applet notifier of available updates.
|
||||||
|
|
||||||
For Arch (based) systems only!
|
For Arch (based) systems only!
|
||||||
|
|
|
@ -27,7 +27,7 @@ try:
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("No config file found\n")
|
print("No config file found\n")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
conf = yaml.load(f, yaml.FullLoader)
|
conf = yaml.load(f,yaml.FullLoader)
|
||||||
term = str(conf['terminal'])
|
term = str(conf['terminal'])
|
||||||
opt = str(conf['option'])
|
opt = str(conf['option'])
|
||||||
wait = int(conf['timer']) * 60000
|
wait = int(conf['timer']) * 60000
|
||||||
|
@ -37,30 +37,30 @@ f.close()
|
||||||
iconDir = '/usr/share/icons/hicolor/symbolic/apps/'
|
iconDir = '/usr/share/icons/hicolor/symbolic/apps/'
|
||||||
match icn:
|
match icn:
|
||||||
case "white":
|
case "white":
|
||||||
icon = QIcon(path.join(iconDir, 'arch-white-symbolic-24.svg'))
|
icon = QIcon(path.join(iconDir,'arch-white-symbolic-24.svg'))
|
||||||
case "blue":
|
case "blue":
|
||||||
icon = QIcon(path.join(iconDir, 'arch-blue-symbolic-24.svg'))
|
icon = QIcon(path.join(iconDir,'arch-blue-symbolic-24.svg'))
|
||||||
case "red":
|
case "red":
|
||||||
icon = QIcon(path.join(iconDir, 'arch-red-symbolic-24.svg'))
|
icon = QIcon(path.join(iconDir,'arch-red-symbolic-24.svg'))
|
||||||
case "green":
|
case "green":
|
||||||
icon = QIcon(path.join(iconDir, 'arch-green-symbolic-24.svg'))
|
icon = QIcon(path.join(iconDir,'arch-green-symbolic-24.svg'))
|
||||||
case "purple":
|
case "purple":
|
||||||
icon = QIcon(path.join(iconDir, 'arch-purple-symbolic-24.svg'))
|
icon = QIcon(path.join(iconDir,'arch-purple-symbolic-24.svg'))
|
||||||
case "yellow":
|
case "yellow":
|
||||||
icon = QIcon(path.join(iconDir, 'arch-yellow-symbolic-24.svg'))
|
icon = QIcon(path.join(iconDir,'arch-yellow-symbolic-24.svg'))
|
||||||
case "black":
|
case "black":
|
||||||
icon = QIcon(path.join(iconDir, 'arch-black-symbolic-24.svg'))
|
icon = QIcon(path.join(iconDir,'arch-black-symbolic-24.svg'))
|
||||||
case "gray":
|
case "gray":
|
||||||
icon = QIcon(path.join(iconDir, 'arch-gray-symbolic-24.svg'))
|
icon = QIcon(path.join(iconDir,'arch-gray-symbolic-24.svg'))
|
||||||
case _:
|
case _:
|
||||||
icon = QIcon(path.join(path.expanduser("~/.config/systrayupdater/"), icn))
|
icon = QIcon(path.join(path.expanduser("~/.config/systrayupdater/"),icn))
|
||||||
|
|
||||||
# Run checkupdates command
|
# Run checkupdates command
|
||||||
# Populates the available updates and count
|
# Populates the available updates and count
|
||||||
# Sets the menu options, list and count in proper spots
|
# Sets the menu options, list and count in proper spots
|
||||||
def count():
|
def count():
|
||||||
cmd = ['checkupdates']
|
cmd = ['checkupdates']
|
||||||
p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
p1 = subprocess.Popen(cmd,stdout=subprocess.PIPE)
|
||||||
global outputList
|
global outputList
|
||||||
outputList = ((p1.communicate()[0]).decode()).rstrip('\n')
|
outputList = ((p1.communicate()[0]).decode()).rstrip('\n')
|
||||||
outputCount = len(outputList.splitlines())
|
outputCount = len(outputList.splitlines())
|
||||||
|
@ -105,12 +105,6 @@ updateTimer.timeout.connect(count)
|
||||||
updateTimer.singleShot(1,count) # Initially populate available updates
|
updateTimer.singleShot(1,count) # Initially populate available updates
|
||||||
updateTimer.start(wait)
|
updateTimer.start(wait)
|
||||||
|
|
||||||
# Adding items to the tray
|
|
||||||
tray = QSystemTrayIcon()
|
|
||||||
tray.setIcon(icon)
|
|
||||||
tray.setToolTip(avail)
|
|
||||||
tray.setVisible(True)
|
|
||||||
|
|
||||||
# Creating the menu/options
|
# Creating the menu/options
|
||||||
menu = QMenu()
|
menu = QMenu()
|
||||||
runUpdate = QAction("Run Update")
|
runUpdate = QAction("Run Update")
|
||||||
|
@ -120,7 +114,9 @@ runUpdate.triggered.connect(update)
|
||||||
readNews.triggered.connect(news)
|
readNews.triggered.connect(news)
|
||||||
quit.triggered.connect(app.quit)
|
quit.triggered.connect(app.quit)
|
||||||
|
|
||||||
# Place the menu in the System Tray
|
# Create applet and place menu in it
|
||||||
|
tray = QSystemTrayIcon()
|
||||||
|
tray.setIcon(icon)
|
||||||
tray.setContextMenu(menu)
|
tray.setContextMenu(menu)
|
||||||
|
|
||||||
app.exec_()
|
app.exec_()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Version=1.0
|
Version=1.0
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=SysTrayUpdater
|
Name=SysTrayUpdater
|
||||||
Exec=/usr/bin/systrayUpdater
|
Exec=/usr/bin/systray-updater
|
||||||
Icon=/usr/share/icons/hicolor/symbolic/arch-blue-symbolic-80.svg
|
Icon=/usr/share/icons/hicolor/symbolic/arch-blue-symbolic-80.svg
|
||||||
Terminal=false
|
Terminal=false
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
|
|
Loading…
Reference in New Issue