diff --git a/.config/hypr/hyprland/keybinds.conf b/.config/hypr/hyprland/keybinds.conf index 4e3a94a8a..a24470334 100644 --- a/.config/hypr/hyprland/keybinds.conf +++ b/.config/hypr/hyprland/keybinds.conf @@ -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 diff --git a/.config/quickshell/ii/modules/background/Background.qml b/.config/quickshell/ii/modules/background/Background.qml index 010f5850f..24a1d0b82 100644 --- a/.config/quickshell/ii/modules/background/Background.qml +++ b/.config/quickshell/ii/modules/background/Background.qml @@ -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 { diff --git a/.config/quickshell/ii/modules/wallpaperSelector/WallpaperSelector.qml b/.config/quickshell/ii/modules/wallpaperSelector/WallpaperSelector.qml index 43ebc31c2..197acbf2e 100644 --- a/.config/quickshell/ii/modules/wallpaperSelector/WallpaperSelector.qml +++ b/.config/quickshell/ii/modules/wallpaperSelector/WallpaperSelector.qml @@ -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(); + } } } diff --git a/.config/quickshell/ii/modules/wallpaperSelector/WallpaperSelectorContent.qml b/.config/quickshell/ii/modules/wallpaperSelector/WallpaperSelectorContent.qml index 1e714d39b..9d89dfd7d 100644 --- a/.config/quickshell/ii/modules/wallpaperSelector/WallpaperSelectorContent.qml +++ b/.config/quickshell/ii/modules/wallpaperSelector/WallpaperSelectorContent.qml @@ -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 diff --git a/.config/quickshell/ii/services/Wallpapers.qml b/.config/quickshell/ii/services/Wallpapers.qml index 07e984ff2..8ee9b7dae 100644 --- a/.config/quickshell/ii/services/Wallpapers.qml +++ b/.config/quickshell/ii/services/Wallpapers.qml @@ -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: "" diff --git a/.config/quickshell/ii/shell.qml b/.config/quickshell/ii/shell.qml index 0abe0dca5..1088669ed 100644 --- a/.config/quickshell/ii/shell.qml +++ b/.config/quickshell/ii/shell.qml @@ -61,6 +61,7 @@ ShellRoot { FirstRunExperience.load() ConflictKiller.load() Cliphist.refresh() + Wallpapers.load() } LazyLoader { active: enableBar && Config.ready && !Config.options.bar.vertical; component: Bar {} }