mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-19 04:08:48 +00:00
wallpaper selector: add random button (#1997)
This commit is contained in:
parent
074f8ed902
commit
426804304c
1 changed files with 25 additions and 4 deletions
|
|
@ -40,6 +40,13 @@ MouseArea {
|
|||
}
|
||||
}
|
||||
|
||||
function selectWallpaperPath(filePath) {
|
||||
if (filePath && filePath.length > 0) {
|
||||
Wallpapers.select(filePath, root.useDarkMode);
|
||||
filterField.text = "";
|
||||
}
|
||||
}
|
||||
|
||||
acceptedButtons: Qt.BackButton | Qt.ForwardButton
|
||||
onPressed: event => {
|
||||
if (event.button === Qt.BackButton) {
|
||||
|
|
@ -267,8 +274,7 @@ MouseArea {
|
|||
|
||||
function activateCurrent() {
|
||||
const filePath = grid.model.get(currentIndex, "filePath")
|
||||
Wallpapers.select(filePath, root.useDarkMode);
|
||||
filterField.text = "";
|
||||
root.selectWallpaperPath(filePath);
|
||||
}
|
||||
|
||||
model: Wallpapers.folderModel
|
||||
|
|
@ -287,8 +293,7 @@ MouseArea {
|
|||
}
|
||||
|
||||
onActivated: {
|
||||
Wallpapers.select(fileModelData.filePath, root.useDarkMode);
|
||||
filterField.text = "";
|
||||
root.selectWallpaperPath(fileModelData.filePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -330,6 +335,22 @@ MouseArea {
|
|||
}
|
||||
}
|
||||
|
||||
ToolbarButton {
|
||||
implicitWidth: height
|
||||
onClicked: {
|
||||
const randomIndex = Math.floor(Math.random() * Wallpapers.folderModel.count);
|
||||
const filePath = Wallpapers.folderModel.get(randomIndex, "filePath");
|
||||
root.selectWallpaperPath(filePath);
|
||||
}
|
||||
contentItem: MaterialSymbol {
|
||||
text: "ifl"
|
||||
iconSize: Appearance.font.pixelSize.larger
|
||||
}
|
||||
StyledToolTip {
|
||||
content: Translation.tr("Pick random from this folder")
|
||||
}
|
||||
}
|
||||
|
||||
ToolbarButton {
|
||||
implicitWidth: height
|
||||
onClicked: root.useDarkMode = !root.useDarkMode
|
||||
|
|
|
|||
Loading…
Reference in a new issue