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
@@ -71,11 +71,25 @@ Scope {
function toggle(): void {
root.toggleWallpaperSelector();
}
function random(): void {
Wallpapers.randomFromCurrentFolder();
}
}
GlobalShortcut {
name: "wallpaperSelectorToggle"
description: "Toggle wallpaper selector"
onPressed: root.toggleWallpaperSelector();
onPressed: {
root.toggleWallpaperSelector();
}
}
GlobalShortcut {
name: "wallpaperSelectorRandom"
description: "Select random wallpaper in current folder"
onPressed: {
Wallpapers.randomFromCurrentFolder();
}
}
}
@@ -341,9 +341,7 @@ MouseArea {
ToolbarButton {
implicitWidth: height
onClicked: {
const randomIndex = Math.floor(Math.random() * Wallpapers.folderModel.count);
const filePath = Wallpapers.folderModel.get(randomIndex, "filePath");
root.selectWallpaperPath(filePath);
Wallpapers.randomFromCurrentFolder();
}
contentItem: MaterialSymbol {
anchors.centerIn: parent