forked from Shinonome/dots-hyprland
add random wallpaper keybind
This commit is contained in:
@@ -50,6 +50,7 @@ bindl = Alt ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle # [hidd
|
||||
bindl = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle # [hidden]
|
||||
bindld = Super+Alt,M, Toggle mic, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle # [hidden]
|
||||
bindd = Ctrl+Super, T, Toggle wallpaper selector, global, quickshell:wallpaperSelectorToggle # Wallpaper selector
|
||||
bindd = Ctrl+Super+Alt, T, Select random wallpaper, global, quickshell:wallpaperSelectorRandom # Random wallpaper
|
||||
bindd = Ctrl+Super, T, Change wallpaper, exec, qs -c $qsConfig ipc call TEST_ALIVE || ~/.config/quickshell/$qsConfig/scripts/colors/switchwall.sh # [hidden] Change wallpaper (fallback)
|
||||
bind = Ctrl+Super, R, exec, killall ags agsv1 gjs ydotool qs quickshell; qs -c $qsConfig & # Restart widgets
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ""
|
||||
|
||||
@@ -61,6 +61,7 @@ ShellRoot {
|
||||
FirstRunExperience.load()
|
||||
ConflictKiller.load()
|
||||
Cliphist.refresh()
|
||||
Wallpapers.load()
|
||||
}
|
||||
|
||||
LazyLoader { active: enableBar && Config.ready && !Config.options.bar.vertical; component: Bar {} }
|
||||
|
||||
Reference in New Issue
Block a user