add random wallpaper keybind

This commit is contained in:
end-4
2025-09-21 20:21:34 +02:00
parent 7bbd1d2d52
commit b90cf14228
6 changed files with 29 additions and 10 deletions
@@ -33,6 +33,8 @@ Singleton {
signal thumbnailGenerated(directory: string)
signal thumbnailGeneratedFile(filePath: string)
function load () {} // For forcing initialization
// Executions
Process {
id: applyProc
@@ -77,6 +79,14 @@ Singleton {
selectProc.select(filePath, darkMode);
}
function randomFromCurrentFolder(darkMode = Appearance.m3colors.darkmode) {
if (folderModel.count === 0) return;
const randomIndex = Math.floor(Math.random() * folderModel.count);
const filePath = folderModel.get(randomIndex, "filePath");
print("Randomly selected wallpaper:", filePath);
root.select(filePath, darkMode);
}
Process {
id: validateDirProc
property string nicePath: ""