From b810188a4b106ee84e1971b0bbd928d27528171f Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 22 Oct 2026 17:26:57 +0200 Subject: theme: stage a scheme and commit it from the header The Theme page applied a scheme on click, so a stray click reinstalled the whole theme, and it was the one settings page without the header's commit point. Clicking now stages the scheme (outlined yellow, "selected"), and Reset / Apply in the header drop or apply it, as the wallpaper page does. The applied notice and any failure moved into the SaveBar, and the sidebar marks the page dirty while a scheme is staged. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/appearance/ThemeTab.qml | 38 +++++++++------------------------ 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'desktop/modules/appearance/ThemeTab.qml') diff --git a/desktop/modules/appearance/ThemeTab.qml b/desktop/modules/appearance/ThemeTab.qml index acee97a..b842c32 100644 --- a/desktop/modules/appearance/ThemeTab.qml +++ b/desktop/modules/appearance/ThemeTab.qml @@ -13,32 +13,12 @@ import QtQuick import "../.." // Colour schemes from unified-desktop-theme, each with its swatches and a mock -// of a panel in its colours. Clicking one applies it through install.sh. +// of a panel in its colours. Clicking one stages it; Apply in the header runs +// install.sh, as the wallpaper page does. Column { id: tab spacing: 10 - // install.sh reloads Hyprland, kitty and conky; this says what it cannot - // reach, or why it failed. - property string notice: "" - Connections { - target: Udt - function onApplied(scheme, ok, message) { - tab.notice = ok - ? `${scheme} applied. Restart Qt, GTK, btop and Joplin; neovim needs :colorscheme udt.` - : `failed: ${message}`; - } - } - - Text { - visible: tab.notice !== "" - width: parent.width - wrapMode: Text.Wrap - text: tab.notice - font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } - color: tab.notice.indexOf("failed") === 0 ? Theme.red : Theme.green - } - Repeater { model: Udt.names @@ -48,6 +28,7 @@ Column { objectName: modelData readonly property var sw: Udt.swatches[modelData] ?? ({}) readonly property bool isCurrent: Udt.current === modelData + readonly property bool isPending: Udt.pending === modelData && !isCurrent width: tab.width implicitHeight: 96 @@ -55,14 +36,15 @@ Column { color: hover.hovered ? Qt.alpha(Theme.surface, 0.75) : Qt.alpha(Theme.surface, 0.35) border.width: 1 - border.color: isCurrent ? Qt.alpha(Theme.accent, 0.6) : "transparent" + border.color: isPending ? Theme.yellow + : isCurrent ? Qt.alpha(Theme.accent, 0.6) : "transparent" HoverHandler { id: hover } MouseArea { anchors.fill: parent - enabled: !Udt.applying && !isCurrent + enabled: !Udt.applying cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor - onClicked: Udt.apply(modelData) + onClicked: Udt.pending = isCurrent ? "" : modelData } Row { @@ -150,10 +132,10 @@ Column { } Text { anchors.verticalCenter: parent.verticalCenter - visible: Udt.applying - text: "applying…" + visible: isPending + text: Udt.applying ? "applying…" : "selected" font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 } - color: Theme.overlay + color: Theme.yellow } } -- cgit v1.2.3