diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..f38184d --- /dev/null +++ b/src/main.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 + +import os +import sys +import signal +from PySide6.QtGui import QGuiApplication +from PySide6.QtCore import QUrl +from PySide6.QtQml import QQmlApplicationEngine + + +def main(): + """Initializes and manages the application execution""" + app: QGuiApplication = QGuiApplication(sys.argv) + engine = QQmlApplicationEngine() + + """Needed to close the app with Ctrl+C""" + signal.signal(signal.SIGINT, signal.SIG_DFL) + + """Needed to get proper KDE style outside of Plasma""" + if not os.environ.get("QT_QUICK_CONTROLS_STYLE"): + os.environ["QT_QUICK_CONTROLS_STYLE"] = "org.kde.desktop" + + base_path = os.path.abspath(os.path.dirname(__file__)) + url = QUrl(f"file://{base_path}/main.qml") + engine.load(url) + + if len(engine.rootObjects()) == 0: + quit() + + app.exec() + + +if __name__ == "__main__": + main()