diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-22 17:26:57 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-22 17:26:57 +0200 |
| commit | b810188a4b106ee84e1971b0bbd928d27528171f (patch) | |
| tree | a41ba51ecb5129d42e5e3504e6d726ae2c0f98a5 /desktop/modules/appearance | |
| parent | 9d9e67a14967fe756c357b0ece3d9f339f8afa17 (diff) | |
| download | quickshell-b810188a4b106ee84e1971b0bbd928d27528171f.tar.gz quickshell-b810188a4b106ee84e1971b0bbd928d27528171f.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/appearance')
| -rw-r--r-- | desktop/modules/appearance/README.md | 3 | ||||
| -rw-r--r-- | desktop/modules/appearance/ThemeModule.qml | 18 | ||||
| -rw-r--r-- | desktop/modules/appearance/ThemeTab.qml | 38 | ||||
| -rw-r--r-- | desktop/modules/appearance/Udt.qml | 5 |
4 files changed, 36 insertions, 28 deletions
diff --git a/desktop/modules/appearance/README.md b/desktop/modules/appearance/README.md index 50da8fb..65132c3 100644 --- a/desktop/modules/appearance/README.md +++ b/desktop/modules/appearance/README.md @@ -142,6 +142,9 @@ Both the scheme list and the wallpaper scan are redone every time the settings window opens: the desktop process runs all session, so a scan done only at startup would go stale the first time anything was added. +Clicking a scheme stages it, outlined yellow, and Apply in the header +applies it; Reset drops the selection. The same commit point every other +settings page has, so a stray click no longer reinstalls the whole theme. Applying writes the `scheme =` line in `~/.config/udt/roles.conf` and runs `install.sh`, which regenerates every themed config and reloads Hyprland, kitty and conky. Its whole output becomes the `install` tab of the diff --git a/desktop/modules/appearance/ThemeModule.qml b/desktop/modules/appearance/ThemeModule.qml index 97ca519..ec9b098 100644 --- a/desktop/modules/appearance/ThemeModule.qml +++ b/desktop/modules/appearance/ThemeModule.qml @@ -19,6 +19,7 @@ Module { // nf-fa-paintbrush, present in Inconsolata Nerd Font. icon: "\uf1fc" settings: true + dirty: Udt.dirty group: "Appearance" keywords: ["colour", "color", "scheme", "palette", "accent", "udt"] searchItems: Array.from(Udt.names).map(n => ({ text: n, key: n })) @@ -28,6 +29,23 @@ Module { page: Component { Page { title: "Theme" + actions: Component { + SaveBar { + id: bar + saveText: "Apply"; discardText: "Reset"; dirty: Udt.dirty; busy: Udt.applying + onSave: { bar.error = ""; bar.notice = ""; Udt.apply(Udt.pending); } + onDiscard: { bar.error = ""; Udt.pending = ""; } + // install.sh reloads Hyprland, kitty and conky; the notice + // says what it cannot reach. + Connections { + target: Udt + function onApplied(scheme, ok, message) { + bar.error = ok ? "" : `failed: ${message}`; + bar.notice = ok ? `${scheme} applied. Restart Qt, GTK, btop and Joplin; neovim needs :colorscheme udt.` : ""; + } + } + } + } ThemeTab { width: parent.width } } } 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 } } diff --git a/desktop/modules/appearance/Udt.qml b/desktop/modules/appearance/Udt.qml index 98fbba7..9ba609f 100644 --- a/desktop/modules/appearance/Udt.qml +++ b/desktop/modules/appearance/Udt.qml @@ -33,6 +33,10 @@ Singleton { property bool applying: false signal applied(string scheme, bool ok, string message) + // A scheme picked on the page, staged until Apply, like a wallpaper. + property string pending: "" + readonly property bool dirty: pending !== "" && pending !== current + // A scheme is two files: <name>.conf holds colours under the scheme's own // names, roles-<name>.conf says what each colour is for. Resolving a role // means looking its value up as a key in the first file. @@ -146,6 +150,7 @@ Singleton { property string scheme: "" onExited: code => { root.applying = false; + if (code === 0) root.pending = ""; root.applied(applyProc.scheme, code === 0, code === 0 ? "" : `install.sh exited ${code}, its output is in the steps window`); } |
