diff --git a/ui/bin/opensnitch-ui b/ui/bin/opensnitch-ui index 34de4912..f57f5450 100755 --- a/ui/bin/opensnitch-ui +++ b/ui/bin/opensnitch-ui @@ -22,7 +22,6 @@ # along with OpenSnitch. If not, see . from PyQt5 import QtWidgets, QtCore -from PyQt5.QtCore import QCoreApplication as QC from PyQt5.QtNetwork import QLocalServer, QLocalSocket import sys @@ -42,7 +41,7 @@ if dist_path not in sys.path: from opensnitch.service import UIService from opensnitch.config import Config from opensnitch.utils import Themes, Utils, Versions, Message -from opensnitch.utils.xdg import xdg_opensnitch_dir +from opensnitch.utils.xdg import xdg_opensnitch_dir, xdg_current_session import opensnitch.ui_pb2 from opensnitch.ui_pb2_grpc import add_UIServicer_to_server from opensnitch import auth @@ -66,6 +65,16 @@ def restrict_socket_perms(socket): except Exception as e: print("Unable to change unix socket permissions:", socket, e) +def check_environ(): + if xdg_current_session == "": + print(""" + + Warning: XDG_SESSION_TYPE is not set. + If there're no icons on the GUI, please, read the following comment: + https://github.com/evilsocket/opensnitch/discussions/999#discussioncomment-6579273 + +""") + def supported_qt_version(major, medium, minor): q = QtCore.QT_VERSION_STR.split(".") return int(q[0]) >= major and int(q[1]) >= medium and int(q[2]) >= minor @@ -153,6 +162,7 @@ Examples: maxmsglen = cfg.getMaxMsgLength() service = UIService(app, on_exit, start_in_bg=args.background) + check_environ() localserver.newConnection.connect(service.OpenWindow) # @doc: https://grpc.github.io/grpc/python/grpc.html#server-object server = grpc.server(futures.ThreadPoolExecutor(), diff --git a/ui/opensnitch/utils/xdg.py b/ui/opensnitch/utils/xdg.py index e0d95d75..2b336d9f 100644 --- a/ui/opensnitch/utils/xdg.py +++ b/ui/opensnitch/utils/xdg.py @@ -105,5 +105,6 @@ _home = os.path.expanduser('~') xdg_config_home = os.environ.get('XDG_CONFIG_HOME') or os.path.join(_home, '.config') xdg_runtime_dir = get_runtime_dir(False) xdg_current_desktop = os.environ.get('XDG_CURRENT_DESKTOP') +xdg_current_session = os.environ.get('XDG_SESSION_TYPE') xdg_opensnitch_dir = get_run_opensnitch_dir()