diff --git a/zapzap/config/SetupManager.py b/zapzap/config/SetupManager.py
index 47f4179..553ff6c 100644
--- a/zapzap/config/SetupManager.py
+++ b/zapzap/config/SetupManager.py
@@ -7,8 +7,8 @@
class SetupManager:
"""Gerencia as configurações de ambiente para o aplicativo."""
- _abs_path = QFileInfo(__file__).absolutePath()
- _is_flatpak = _abs_path.startswith('/app/')
+ _is_flatpak = QFileInfo(__file__).absolutePath().startswith('/app/')
+ _qt_platform = "xcb" # Valor padrão
@staticmethod
def apply():
@@ -16,8 +16,12 @@ def apply():
Aplica configurações específicas de ambiente dependendo do ambiente de execução.
Configura a plataforma gráfica e escalonamento de tela.
"""
+ if not SetupManager._is_flatpak:
+ SetupManager._qt_platform = "wayland" if SettingsManager.get(
+ "system/wayland", False) else "xcb"
+
+ environ['QT_QPA_PLATFORM'] = SetupManager._qt_platform
- environ['QT_QPA_PLATFORM'] = "xcb"
environ['QT_SCALE_FACTOR'] = str(int(SettingsManager.get(
"system/scale", 100))/100)
environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
diff --git a/zapzap/controllers/PageGeneral.py b/zapzap/controllers/PageGeneral.py
index 41186f9..1c65d56 100644
--- a/zapzap/controllers/PageGeneral.py
+++ b/zapzap/controllers/PageGeneral.py
@@ -1,4 +1,5 @@
from PyQt6.QtWidgets import QWidget, QApplication, QStyle
+from zapzap.config.SetupManager import SetupManager
from zapzap.services.AutostartManager import AutostartManager
from zapzap.services.DictionariesManager import DictionariesManager
from zapzap.services.DownloadManager import DownloadManager
@@ -28,6 +29,10 @@ def _configure_ui(self):
self.style().standardIcon(QStyle.StandardPixmap.SP_DirIcon))
self.btn_default_path_spell.setIcon(self.style().standardIcon(
QStyle.StandardPixmap.SP_DialogResetButton))
+
+ if SetupManager._is_flatpak:
+ self.btn_wayland.setDisabled(True)
+ self.btn_wayland.setToolTip("Use Flatseal to change this mode of execution.")
def _load_settings(self):
"""
@@ -61,6 +66,9 @@ def _load_settings(self):
self.btn_start_system.setChecked(
SettingsManager.get("system/start_system", False))
+ self.btn_wayland.setChecked(
+ SettingsManager.get("system/wayland", False))
+
def _configure_signals(self):
"""
Conecta os sinais dos widgets aos respectivos manipuladores:
@@ -81,6 +89,9 @@ def _configure_signals(self):
lambda: SettingsManager.set("system/start_background", self.btn_start_background.isChecked()))
self.btn_start_system.clicked.connect(self._handle_autostart)
+ self.btn_wayland.clicked.connect(
+ lambda: SettingsManager.set("system/wayland", self.btn_wayland.isChecked()))
+
def _handle_spellcheck(self, lang: str):
"""
Manipula a mudança de idioma para o corretor ortográfico.
diff --git a/zapzap/ui/ui_page_general.ui b/zapzap/ui/ui_page_general.ui
index 3452255..cc47810 100644
--- a/zapzap/ui/ui_page_general.ui
+++ b/zapzap/ui/ui_page_general.ui
@@ -172,6 +172,20 @@
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ -
+
+
+ Wayland window system
+
+
+
diff --git a/zapzap/views/ui_page_general.py b/zapzap/views/ui_page_general.py
index 8de90c8..a299152 100644
--- a/zapzap/views/ui_page_general.py
+++ b/zapzap/views/ui_page_general.py
@@ -95,6 +95,14 @@ def setupUi(self, PageGeneral):
self.btn_start_system = QtWidgets.QCheckBox(parent=self.groupBox_2)
self.btn_start_system.setObjectName("btn_start_system")
self.verticalLayout.addWidget(self.btn_start_system)
+ self.line = QtWidgets.QFrame(parent=self.groupBox_2)
+ self.line.setFrameShape(QtWidgets.QFrame.Shape.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
+ self.line.setObjectName("line")
+ self.verticalLayout.addWidget(self.line)
+ self.btn_wayland = QtWidgets.QCheckBox(parent=self.groupBox_2)
+ self.btn_wayland.setObjectName("btn_wayland")
+ self.verticalLayout.addWidget(self.btn_wayland)
self.verticalLayout_2.addWidget(self.groupBox_2)
self.horizontalLayout.addWidget(self.frame)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
@@ -117,6 +125,7 @@ def retranslateUi(self, PageGeneral):
self.btn_quit_in_close.setText(_translate("PageGeneral", "Closer when closing the window"))
self.btn_start_background.setText(_translate("PageGeneral", "Start minimized"))
self.btn_start_system.setText(_translate("PageGeneral", "Start with the system"))
+ self.btn_wayland.setText(_translate("PageGeneral", "Wayland window system"))
if __name__ == "__main__":