feat(wallpaper): added ability for granular pick of transitions via checkboxes

This commit is contained in:
Lemmy
2026-03-14 20:42:33 -04:00
parent 793771cd77
commit bf234e502d
8 changed files with 98 additions and 25 deletions
+18 -12
View File
@@ -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
@@ -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 {
@@ -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 {