diff --git a/src/mambatray b/src/mambatray index f437ceb..32b58de 100755 --- a/src/mambatray +++ b/src/mambatray @@ -14,7 +14,7 @@ from PyQt4 import QtCore class SystemTrayIcon(QtGui.QSystemTrayIcon): def __init__(self, icon, parent=None): - global w, menu, contatore, srpm, lista, NetsrpmsArg, nOre + global w, menu, contatore, srpm, lista, NetsrpmsArg, nOre, desktop_session nOre = 2 srpm = ["skype", "flashplugin", "win32codecs", "msttcorefonts", "b43-firmware"] NetsrpmsArg = "-c" @@ -23,7 +23,13 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon): w = parent QtGui.QSystemTrayIcon.__init__(self, icon, parent) menu = QtGui.QMenu(parent) - + + desktop_session = QtCore.QString(os.getenv('DESKTOP_SESSION')) + if desktop_session == 'default': + desktop_session = QtCore.QString('kde') + if desktop_session.left(3) == 'kde': + desktop_session = QtCore.QString('kde') + # refresh packages cache timer global refreshPackagesTimer, refreshPackagesCacheProcess, checkSRPMSUpdatesTimer, SRPMUpdateProcess refreshPackagesTimer = QtCore.QTimer(self) @@ -119,11 +125,16 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon): return result def softwareManager(self): - softwareManagerProcess.execute("/opt/kde/bin/kpackagekit") + if desktop_session == 'kde': + softwareManagerProcess.execute("/opt/kde/bin/kpackagekit") + else: + softwareManagerProcess.execute("/usr/bin/gpk-application") def softwareCheckUpgrades(self): - softwareCheckUpgradesProcess.start("/opt/kde/bin/kpackagekit", ['--updates']) - + if desktop_session == 'kde': + softwareCheckUpgradesProcess.start("/opt/kde/bin/kpackagekit", ['--updates']) + else: + softwareCheckUpgradesProcess.start("/usr/bin/gpk-update-viewer") def refreshPackagesCache(self): refreshPackagesTimer.stop() refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh'])