forked from Shinonome/dots-hyprland
add random wallpaper keybind
This commit is contained in:
@@ -263,12 +263,7 @@ Variants {
|
||||
property real effectiveValueY: Math.max(0, Math.min(1, valueY))
|
||||
x: -(bgRoot.movableXSpace) - (effectiveValueX - 0.5) * 2 * bgRoot.movableXSpace
|
||||
y: -(bgRoot.movableYSpace) - (effectiveValueY - 0.5) * 2 * bgRoot.movableYSpace
|
||||
source: {
|
||||
print("-----------------")
|
||||
print("Safety triggered:", bgRoot.wallpaperSafetyTriggered);
|
||||
print("Wallpaper path:", bgRoot.wallpaperPath);
|
||||
return bgRoot.wallpaperSafetyTriggered ? "" : bgRoot.wallpaperPath
|
||||
}
|
||||
source: bgRoot.wallpaperSafetyTriggered ? "" : bgRoot.wallpaperPath
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
Behavior on x {
|
||||
NumberAnimation {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user