From 80034d86580922105f13ca7c0625eb3f3dac9827 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 2 Sep 2025 19:57:17 +0200 Subject: [PATCH] background: add auto vertical parallax option --- .config/quickshell/ii/modules/background/Background.qml | 5 +++-- .config/quickshell/ii/modules/common/Config.qml | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/ii/modules/background/Background.qml b/.config/quickshell/ii/modules/background/Background.qml index a244e0f56..f5af3d114 100644 --- a/.config/quickshell/ii/modules/background/Background.qml +++ b/.config/quickshell/ii/modules/background/Background.qml @@ -51,6 +51,7 @@ Variants { property int wallpaperHeight: modelData.height // Some reasonable init value, to be updated property real movableXSpace: ((wallpaperWidth / wallpaperToScreenRatio * effectiveWallpaperScale) - screen.width) / 2 property real movableYSpace: ((wallpaperHeight / wallpaperToScreenRatio * effectiveWallpaperScale) - screen.height) / 2 + readonly property bool verticalParallax: (Config.options.background.parallax.autoVertical && wallpaperHeight > wallpaperWidth) || Config.options.background.parallax.vertical // Position property real clockX: (modelData.width / 2) + ((Math.random() < 0.5 ? -1 : 1) * modelData.width) property real clockY: (modelData.height / 2) + ((Math.random() < 0.5 ? -1 : 1) * modelData.height) @@ -173,7 +174,7 @@ Variants { property int range: upper - lower; property real valueX: { let result = 0.5; - if (Config.options.background.parallax.enableWorkspace && !Config.options.background.parallax.vertical) { + if (Config.options.background.parallax.enableWorkspace && !bgRoot.verticalParallax) { result = ((bgRoot.monitor.activeWorkspace?.id - lower) / range); } if (Config.options.background.parallax.enableSidebar) { @@ -183,7 +184,7 @@ Variants { } property real valueY: { let result = 0.5; - if (Config.options.background.parallax.enableWorkspace && Config.options.background.parallax.vertical) { + if (Config.options.background.parallax.enableWorkspace && bgRoot.verticalParallax) { result = ((bgRoot.monitor.activeWorkspace?.id - lower) / range); } return result; diff --git a/.config/quickshell/ii/modules/common/Config.qml b/.config/quickshell/ii/modules/common/Config.qml index 7388e7570..94409535b 100644 --- a/.config/quickshell/ii/modules/common/Config.qml +++ b/.config/quickshell/ii/modules/common/Config.qml @@ -124,6 +124,7 @@ Singleton { property string thumbnailPath: "" property JsonObject parallax: JsonObject { property bool vertical: false + property bool autoVertical: false property bool enableWorkspace: true property real workspaceZoom: 1.07 // Relative to your screen, not wallpaper size property bool enableSidebar: true