mambatray.py: support for "plasmawayland" session

This commit is contained in:
Silvan 2024-02-25 15:16:46 +01:00
parent 44e6b42342
commit bc1b15a666

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
# mambatray 2 # mambatray 2
# Copyright (C) 2011-2022 by Silvan Calarco # Copyright (C) 2011-2024 by Silvan Calarco
# Copyright (C) 2011 by michiamophil # Copyright (C) 2011 by michiamophil
# Distributed under the terms of the GPL version 3 FLOSS License # Distributed under the terms of the GPL version 3 FLOSS License
# #
@ -9,11 +9,10 @@ import os
import gettext import gettext
import libproxy import libproxy
import distro import distro
from PyQt5 import uic from PyQt5.QtCore import Qt
from PyQt5.QtCore import pyqtSignal, Qt
from PyQt5.QtGui import QIcon, QCursor from PyQt5.QtGui import QIcon, QCursor
from PyQt5.QtWidgets import QSystemTrayIcon, QApplication, QMenu, QMainWindow,\ from PyQt5.QtWidgets import QSystemTrayIcon, QApplication, QMenu, QMainWindow,\
QMessageBox, QWidget QMessageBox
from PyQt5.QtCore import QTimer, QProcess from PyQt5.QtCore import QTimer, QProcess
DATADIR = os.path.dirname(os.path.realpath((__file__))) + "/" DATADIR = os.path.dirname(os.path.realpath((__file__))) + "/"
@ -190,13 +189,13 @@ class SystemTrayIcon(QSystemTrayIcon):
self.showMessage("Firewall", _("Could not enable firewall")) self.showMessage("Firewall", _("Could not enable firewall"))
def networkFirewallConfigure(self): def networkFirewallConfigure(self):
if desktop_session == 'kde' or desktop_session == 'plasma': if desktop_session == 'kde' or desktop_session.startswith('plasma'):
networkFirewallConfigureProcess.execute("/usr/bin/kcmshell5", list(set(['firewall']))) networkFirewallConfigureProcess.execute("/usr/bin/kcmshell5", list(set(['firewall'])))
else: else:
networkFirewallConfigureProcess.execute("/usr/bin/gufw") networkFirewallConfigureProcess.execute("/usr/bin/gufw")
def networkProxy(self): def networkProxy(self):
if desktop_session == 'plasma': if desktop_session.startswith('plasma'):
networkProxyProcess.execute("/usr/bin/kcmshell5", list(set(['proxy']))) networkProxyProcess.execute("/usr/bin/kcmshell5", list(set(['proxy'])))
elif desktop_session == 'kde': elif desktop_session == 'kde':
networkProxyProcess.execute("/opt/kde/bin/kcmshell4", list(set(['proxy']))) networkProxyProcess.execute("/opt/kde/bin/kcmshell4", list(set(['proxy'])))