mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +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
|
acceptedButtons: Qt.BackButton | Qt.ForwardButton
|
||||||
onPressed: event => {
|
onPressed: event => {
|
||||||
if (event.button === Qt.BackButton) {
|
if (event.button === Qt.BackButton) {
|
||||||
|
|
@ -267,8 +274,7 @@ MouseArea {
|
||||||
|
|
||||||
function activateCurrent() {
|
function activateCurrent() {
|
||||||
const filePath = grid.model.get(currentIndex, "filePath")
|
const filePath = grid.model.get(currentIndex, "filePath")
|
||||||
Wallpapers.select(filePath, root.useDarkMode);
|
root.selectWallpaperPath(filePath);
|
||||||
filterField.text = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model: Wallpapers.folderModel
|
model: Wallpapers.folderModel
|
||||||
|
|
@ -287,8 +293,7 @@ MouseArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
Wallpapers.select(fileModelData.filePath, root.useDarkMode);
|
root.selectWallpaperPath(fileModelData.filePath);
|
||||||
filterField.text = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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 {
|
ToolbarButton {
|
||||||
implicitWidth: height
|
implicitWidth: height
|
||||||
onClicked: root.useDarkMode = !root.useDarkMode
|
onClicked: root.useDarkMode = !root.useDarkMode
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue