From 6415588b0835e5bba767a3aed6499404a6851f8e Mon Sep 17 00:00:00 2001 From: Emanuela Date: Sun, 31 May 2026 19:04:07 +0300 Subject: [PATCH 1/3] added disable button on home page --- src/unidesk/home.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/unidesk/home.py b/src/unidesk/home.py index 9092e17..64140c7 100644 --- a/src/unidesk/home.py +++ b/src/unidesk/home.py @@ -1,5 +1,14 @@ import sys import os + +AUTOSTART_PATH = os.path.expanduser("~/.config/autostart/unidesk.desktop") + +def _is_autostart_disabled(): + if not os.path.exists(AUTOSTART_PATH): + return False + with open(AUTOSTART_PATH) as f: + return "Hidden=true" in f.read() + sys.path.insert(0, os.path.dirname(__file__)) from PyQt6.QtWidgets import ( @@ -289,6 +298,17 @@ def _build_main(self): left_col.addWidget(btn) left_col.addStretch() + self._autostart_btn = QPushButton( + "Enable Auto-start" if _is_autostart_disabled() else "Disable Auto-start" + ) + self._autostart_btn.setStyleSheet( + "QPushButton { background: transparent; border: 1px solid #585b70; border-radius: 4px; " + "color: #585b70; font-size: 11px; padding: 4px 10px; }" + "QPushButton:hover { border-color: #a6adc8; color: #a6adc8; }" + ) + self._autostart_btn.clicked.connect(self._toggle_autostart) + left_col.addWidget(self._autostart_btn) + right_col = QVBoxLayout() right_col.setSpacing(10) for key in NAV_RIGHT: @@ -315,6 +335,20 @@ def _build_subpages(self): for key, widget in subpages.items(): self._page_indices[key] = self._stack.addWidget(widget) + def _toggle_autostart(self): + if _is_autostart_disabled(): + os.remove(AUTOSTART_PATH) + self._autostart_btn.setText("Disable Auto-start") + else: + os.makedirs(os.path.dirname(AUTOSTART_PATH), exist_ok=True) + with open(AUTOSTART_PATH, "w") as f: + f.write( + "[Desktop Entry]\nType=Application\nName=UniDesk\n" + "Exec=unidesk\nIcon=unios\nTerminal=false\n" + "X-KDE-autostart-condition=false\nHidden=true\n" + ) + self._autostart_btn.setText("Enable Auto-start") + def _show_page(self, key): self._stack.setCurrentIndex(self._page_indices[key]) From 1c67ed75ed98d639b4f6ec63281480390fa8f4f4 Mon Sep 17 00:00:00 2001 From: Emanuela Date: Sun, 14 Jun 2026 16:37:09 +0300 Subject: [PATCH 2/3] fixed the errors on the button and changed some dead links --- src/unidesk/home.py | 23 ++++++++++------------- src/unidesk/main.py | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/unidesk/home.py b/src/unidesk/home.py index 64140c7..83a102b 100644 --- a/src/unidesk/home.py +++ b/src/unidesk/home.py @@ -1,15 +1,5 @@ -import sys import os - -AUTOSTART_PATH = os.path.expanduser("~/.config/autostart/unidesk.desktop") - -def _is_autostart_disabled(): - if not os.path.exists(AUTOSTART_PATH): - return False - with open(AUTOSTART_PATH) as f: - return "Hidden=true" in f.read() - -sys.path.insert(0, os.path.dirname(__file__)) +import sys from PyQt6.QtWidgets import ( QWidget, QVBoxLayout, QHBoxLayout, QLabel, @@ -18,14 +8,21 @@ def _is_autostart_disabled(): ) from PyQt6.QtCore import Qt, QUrl from PyQt6.QtGui import QDesktopServices - from pages import PAGES from credits import CREDITS from links import LINKS +AUTOSTART_PATH = os.path.expanduser("~/.config/autostart/unidesk.desktop") + +def _is_autostart_disabled(): + if not os.path.exists(AUTOSTART_PATH): + return False + with open(AUTOSTART_PATH) as f: + return "Hidden=true" in f.read() + FOOTER_LINKS = [ - {"label": "Discord", "url": "https://discord.gg/FJbv84uT"}, + {"label": "Discord", "url": "https://discord.gg/QA9AxTdppX"}, {"label": "GitHub", "url": "https://github.com/open-source-uom"}, {"label": "Website", "url": "https://open-source-uom.github.io/UniOS-landing-page/"}, ] diff --git a/src/unidesk/main.py b/src/unidesk/main.py index cc3228a..999d418 100644 --- a/src/unidesk/main.py +++ b/src/unidesk/main.py @@ -2,7 +2,7 @@ import sys from PyQt6.QtGui import QIcon from PyQt6.QtWidgets import QApplication -from .home import UniOSWelcome +from home import UniOSWelcome def main(): From fd573f7112125526f23cb3644651f55a57f8d5ae Mon Sep 17 00:00:00 2001 From: Emanuela Date: Sun, 21 Jun 2026 16:31:56 +0300 Subject: [PATCH 3/3] chacked the aesthetics of the button --- src/unidesk/home.py | 64 +++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/src/unidesk/home.py b/src/unidesk/home.py index 83a102b..e4b052e 100644 --- a/src/unidesk/home.py +++ b/src/unidesk/home.py @@ -1,10 +1,11 @@ import os import sys +import tempfile from PyQt6.QtWidgets import ( QWidget, QVBoxLayout, QHBoxLayout, QLabel, QFrame, QPushButton, QStackedWidget, QScrollArea, - QApplication, QMainWindow + QApplication, QMainWindow, QCheckBox ) from PyQt6.QtCore import Qt, QUrl from PyQt6.QtGui import QDesktopServices @@ -295,16 +296,47 @@ def _build_main(self): left_col.addWidget(btn) left_col.addStretch() - self._autostart_btn = QPushButton( - "Enable Auto-start" if _is_autostart_disabled() else "Disable Auto-start" - ) - self._autostart_btn.setStyleSheet( - "QPushButton { background: transparent; border: 1px solid #585b70; border-radius: 4px; " - "color: #585b70; font-size: 11px; padding: 4px 10px; }" - "QPushButton:hover { border-color: #a6adc8; color: #a6adc8; }" - ) - self._autostart_btn.clicked.connect(self._toggle_autostart) - left_col.addWidget(self._autostart_btn) + center_col = QVBoxLayout() + center_col.setAlignment(Qt.AlignmentFlag.AlignCenter) + self._autostart_cb = QCheckBox("Auto start") + self._autostart_cb.setChecked(True) + _svg = b"" + _f = tempfile.NamedTemporaryFile(suffix=".svg", delete=False) + _f.write(_svg) + _f.flush() + _check_path = _f.name + + self._autostart_cb.setStyleSheet(""" + QCheckBox { + color: #a6adc8; + font-size: 12px; + background: transparent; + spacing: 8px; + } + QCheckBox::indicator { + width: 16px; + height: 16px; + border: 1px solid #585b70; + border-radius: 4px; + background: transparent; + } + QCheckBox::indicator:hover { + border-color: #a6adc8; + } + QCheckBox::indicator:checked { + background-color: #8b5897; + border-color: #cba6f7; + image: url(%s); + } + QCheckBox::indicator:checked:hover { + background-color: #9b68a7; + } + """ % _check_path) + + self._autostart_cb.stateChanged.connect(self._toggle_autostart) + center_col.addStretch() + center_col.addWidget(self._autostart_cb, alignment=Qt.AlignmentFlag.AlignHCenter) + center_col.addStretch() right_col = QVBoxLayout() right_col.setSpacing(10) @@ -316,6 +348,7 @@ def _build_main(self): nav_layout.addLayout(left_col) nav_layout.addLayout(right_col) + left_col.addWidget(self._autostart_cb) mp.addWidget(nav_widget, stretch=1) mp.addWidget(_divider()) @@ -332,10 +365,10 @@ def _build_subpages(self): for key, widget in subpages.items(): self._page_indices[key] = self._stack.addWidget(widget) - def _toggle_autostart(self): - if _is_autostart_disabled(): - os.remove(AUTOSTART_PATH) - self._autostart_btn.setText("Disable Auto-start") + def _toggle_autostart(self, state): + if self._autostart_cb.isChecked(): + if os.path.exists(AUTOSTART_PATH): + os.remove(AUTOSTART_PATH) else: os.makedirs(os.path.dirname(AUTOSTART_PATH), exist_ok=True) with open(AUTOSTART_PATH, "w") as f: @@ -344,7 +377,6 @@ def _toggle_autostart(self): "Exec=unidesk\nIcon=unios\nTerminal=false\n" "X-KDE-autostart-condition=false\nHidden=true\n" ) - self._autostart_btn.setText("Enable Auto-start") def _show_page(self, key): self._stack.setCurrentIndex(self._page_indices[key])