From 00c28f69fd9ec285063559300781a9ff1ca403de Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 21 Jul 2026 11:45:18 -0400 Subject: [PATCH] wallpaper: use filter chips for rando transitions --- quickshell/Modules/Settings/WallpaperTab.qml | 16 +++++++++------- quickshell/Widgets/DankFilterChips.qml | 10 +++++++++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/quickshell/Modules/Settings/WallpaperTab.qml b/quickshell/Modules/Settings/WallpaperTab.qml index 90afda2c3..b3f7b7235 100644 --- a/quickshell/Modules/Settings/WallpaperTab.qml +++ b/quickshell/Modules/Settings/WallpaperTab.qml @@ -1199,16 +1199,18 @@ Item { width: parent.width - Theme.spacingM * 2 } - DankButtonGroup { + DankFilterChips { id: transitionGroup width: parent.width - Theme.spacingM * 2 - selectionMode: "multi" - model: SessionData.availableWallpaperTransitions.filter(t => t !== "none") - initialSelection: SessionData.includedTransitions - currentSelection: SessionData.includedTransitions + multiSelect: true + model: SessionData.availableWallpaperTransitions.filter(t => t !== "none").map(t => ({ + "value": t, + "label": t.replace(/\b\w/g, c => c.toUpperCase()) + })) + selectedValues: SessionData.includedTransitions - onSelectionChanged: (index, selected) => { - const transition = model[index]; + onSelectionToggled: (index, selected) => { + const transition = model[index].value; let newIncluded = SessionData.includedTransitions.slice(); if (selected && !newIncluded.includes(transition)) { diff --git a/quickshell/Widgets/DankFilterChips.qml b/quickshell/Widgets/DankFilterChips.qml index 0a0083159..bdca5938a 100644 --- a/quickshell/Widgets/DankFilterChips.qml +++ b/quickshell/Widgets/DankFilterChips.qml @@ -7,12 +7,15 @@ Flow { property var model: [] property int currentIndex: 0 + property bool multiSelect: false + property var selectedValues: [] property int chipHeight: 32 property int chipPadding: Theme.spacingM property bool showCheck: true property bool showCounts: true signal selectionChanged(int index) + signal selectionToggled(int index, bool selected) spacing: Theme.spacingS width: parent ? parent.width : 400 @@ -25,7 +28,8 @@ Flow { required property var modelData required property int index - property bool selected: index === root.currentIndex + property var value: typeof modelData === "string" ? modelData : (modelData.value !== undefined ? modelData.value : (modelData.label || "")) + property bool selected: root.multiSelect ? root.selectedValues.includes(value) : (index === root.currentIndex) property bool hovered: mouseArea.containsMouse property bool pressed: mouseArea.pressed property string label: typeof modelData === "string" ? modelData : (modelData.label || "") @@ -99,6 +103,10 @@ Flow { cursorShape: Qt.PointingHandCursor onPressed: mouse => chipRipple.trigger(mouse.x, mouse.y) onClicked: { + if (root.multiSelect) { + root.selectionToggled(chip.index, !chip.selected); + return; + } root.currentIndex = chip.index; root.selectionChanged(chip.index); }