forked from Shinonome/dots-hyprland
add random wallpaper keybind
This commit is contained in:
@@ -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: ""
|
||||
|
||||
Reference in New Issue
Block a user