From bf234e502da5fb1d6c9b462c5b20e5aeae736bae Mon Sep 17 00:00:00 2001 From: Lemmy Date: Sat, 14 Mar 2026 20:42:33 -0400 Subject: [PATCH] feat(wallpaper): added ability for granular pick of transitions via checkboxes --- Assets/settings-default.json | 9 +++- Assets/settings-search-index.json | 2 +- Commons/Migrations/Migration59.qml | 25 ++++++++++ Commons/Migrations/MigrationRegistry.qml | 4 +- Commons/Settings.qml | 4 +- Modules/Background/Background.qml | 30 +++++++----- .../Tabs/Wallpaper/AutomationSubTab.qml | 2 +- .../Tabs/Wallpaper/LookAndFeelSubTab.qml | 47 ++++++++++++++++--- 8 files changed, 98 insertions(+), 25 deletions(-) create mode 100644 Commons/Migrations/Migration59.qml diff --git a/Assets/settings-default.json b/Assets/settings-default.json index 682d860fb..27cf5b45b 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -205,7 +205,14 @@ "wallpaperChangeMode": "random", "randomIntervalSec": 300, "transitionDuration": 1500, - "transitionType": "random", + "transitionType": [ + "fade", + "disc", + "stripes", + "wipe", + "pixelate", + "honeycomb" + ], "skipStartupTransition": false, "transitionEdgeSmoothness": 0.05, "panelPosition": "follow_bar", diff --git a/Assets/settings-search-index.json b/Assets/settings-search-index.json index 18351bef8..cbc3af07c 100644 --- a/Assets/settings-search-index.json +++ b/Assets/settings-search-index.json @@ -2499,7 +2499,7 @@ { "labelKey": "panels.wallpaper.look-feel-transition-type-label", "descriptionKey": "panels.wallpaper.look-feel-transition-type-description", - "widget": "NComboBox", + "widget": "NLabel", "tab": 3, "tabLabel": "common.wallpaper", "subTab": 1, diff --git a/Commons/Migrations/Migration59.qml b/Commons/Migrations/Migration59.qml new file mode 100644 index 000000000..89d8bba23 --- /dev/null +++ b/Commons/Migrations/Migration59.qml @@ -0,0 +1,25 @@ +import QtQuick + +QtObject { + function migrate(adapter, logger, rawJson) { + logger.i("Settings", "Migrating settings to v59 (wallpaper.transitionType: string -> array)"); + + if (rawJson && rawJson.wallpaper && typeof rawJson.wallpaper.transitionType === "string") { + var oldValue = rawJson.wallpaper.transitionType; + var newValue; + + if (oldValue === "random") { + newValue = ["fade", "disc", "stripes", "wipe", "pixelate", "honeycomb"]; + } else if (oldValue === "none") { + newValue = []; + } else { + newValue = [oldValue]; + } + + adapter.wallpaper.transitionType = newValue; + logger.i("Settings", "Migrated wallpaper.transitionType:", oldValue, "->", JSON.stringify(newValue)); + } + + return true; + } +} diff --git a/Commons/Migrations/MigrationRegistry.qml b/Commons/Migrations/MigrationRegistry.qml index 10a8a4301..80a957157 100644 --- a/Commons/Migrations/MigrationRegistry.qml +++ b/Commons/Migrations/MigrationRegistry.qml @@ -30,7 +30,8 @@ QtObject { 55: migration55Component, 56: migration56Component, 57: migration57Component, - 58: migration58Component + 58: migration58Component, + 59: migration59Component }) // Migration components @@ -58,4 +59,5 @@ QtObject { property Component migration56Component: Migration56 {} property Component migration57Component: Migration57 {} property Component migration58Component: Migration58 {} + property Component migration59Component: Migration59 {} } diff --git a/Commons/Settings.qml b/Commons/Settings.qml index fd9b2f597..fe44e8bab 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -25,7 +25,7 @@ Singleton { - Default cache directory: ~/.cache/noctalia */ readonly property alias data: adapter // Used to access via Settings.data.xxx.yyy - readonly property int settingsVersion: 58 + readonly property int settingsVersion: 59 property bool isDebug: Quickshell.env("NOCTALIA_DEBUG") === "1" readonly property string shellName: "noctalia" readonly property string configDir: Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/" @@ -389,7 +389,7 @@ Singleton { property string wallpaperChangeMode: "random" // "random" or "alphabetical" property int randomIntervalSec: 300 // 5 min property int transitionDuration: 1500 // 1500 ms - property string transitionType: "random" + property list transitionType: ["fade", "disc", "stripes", "wipe", "pixelate", "honeycomb"] property bool skipStartupTransition: false property real transitionEdgeSmoothness: 0.05 property string panelPosition: "follow_bar" diff --git a/Modules/Background/Background.qml b/Modules/Background/Background.qml index ea74e5b70..3f3c6cdf8 100644 --- a/Modules/Background/Background.qml +++ b/Modules/Background/Background.qml @@ -673,12 +673,15 @@ Variants { // ------------------------------------------------------ // Main method that actually trigger the wallpaper change function changeWallpaper() { - // Get the transitionType from the settings - transitionType = Settings.data.wallpaper.transitionType; - - if (transitionType == "random") { - var index = Math.floor(Math.random() * allTransitions.length); - transitionType = allTransitions[index]; + // Pick a transition from the user's selected list + var selected = Settings.data.wallpaper.transitionType; + if (!selected || selected.length === 0) { + transitionType = "none"; + } else if (selected.length === 1) { + transitionType = selected[0]; + } else { + var index = Math.floor(Math.random() * selected.length); + transitionType = selected[index]; } // Ensure the transition type really exists @@ -732,12 +735,15 @@ Variants { return; } - // Get the transitionType from the settings - transitionType = Settings.data.wallpaper.transitionType; - - if (transitionType == "random") { - var index = Math.floor(Math.random() * allTransitions.length); - transitionType = allTransitions[index]; + // Pick a transition from the user's selected list + var selected = Settings.data.wallpaper.transitionType; + if (!selected || selected.length === 0) { + transitionType = "none"; + } else if (selected.length === 1) { + transitionType = selected[0]; + } else { + var index = Math.floor(Math.random() * selected.length); + transitionType = selected[index]; } // Ensure the transition type really exists diff --git a/Modules/Panels/Settings/Tabs/Wallpaper/AutomationSubTab.qml b/Modules/Panels/Settings/Tabs/Wallpaper/AutomationSubTab.qml index 3c6bbe4f3..818c2c21b 100644 --- a/Modules/Panels/Settings/Tabs/Wallpaper/AutomationSubTab.qml +++ b/Modules/Panels/Settings/Tabs/Wallpaper/AutomationSubTab.qml @@ -40,7 +40,7 @@ ColumnLayout { ] currentKey: Settings.data.wallpaper.wallpaperChangeMode || "random" onSelected: key => Settings.data.wallpaper.wallpaperChangeMode = key - defaultValue: Settings.getDefaultValue("wallpaper.transitionType") + defaultValue: Settings.getDefaultValue("wallpaper.wallpaperChangeMode") } RowLayout { diff --git a/Modules/Panels/Settings/Tabs/Wallpaper/LookAndFeelSubTab.qml b/Modules/Panels/Settings/Tabs/Wallpaper/LookAndFeelSubTab.qml index 72039c0bf..61ae26143 100644 --- a/Modules/Panels/Settings/Tabs/Wallpaper/LookAndFeelSubTab.qml +++ b/Modules/Panels/Settings/Tabs/Wallpaper/LookAndFeelSubTab.qml @@ -36,13 +36,46 @@ ColumnLayout { } } - NComboBox { - label: I18n.tr("panels.wallpaper.look-feel-transition-type-label") - description: I18n.tr("panels.wallpaper.look-feel-transition-type-description") - model: WallpaperService.transitionsModel - currentKey: Settings.data.wallpaper.transitionType - onSelected: key => Settings.data.wallpaper.transitionType = key - defaultValue: Settings.getDefaultValue("wallpaper.transitionType") + NDivider { + Layout.fillWidth: true + } + + ColumnLayout { + spacing: Style.marginS + Layout.fillWidth: true + + NLabel { + label: I18n.tr("panels.wallpaper.look-feel-transition-type-label") + description: I18n.tr("panels.wallpaper.look-feel-transition-type-description") + } + + Repeater { + model: WallpaperService.allTransitions + + NCheckbox { + required property string modelData + + label: { + var key = "wallpaper.transitions." + modelData; + return I18n.tr(key); + } + checked: Settings.data.wallpaper.transitionType.includes(modelData) + onToggled: { + var arr = Array.from(Settings.data.wallpaper.transitionType); + if (checked) { + if (!arr.includes(modelData)) + arr.push(modelData); + } else { + arr = arr.filter(k => k !== modelData); + } + Settings.data.wallpaper.transitionType = arr; + } + } + } + } + + NDivider { + Layout.fillWidth: true } NToggle {