From 1193b7a80223b7a7e9822a4b10c82b4ea2afc197 Mon Sep 17 00:00:00 2001 From: EoinKanro <54404008+EoinKanro@users.noreply.github.com> Date: Thu, 4 Dec 2025 22:30:55 +0100 Subject: [PATCH 1/8] Rework parallax --- .../quickshell/ii/modules/common/Config.qml | 2 +- .../ii/modules/ii/background/Background.qml | 114 ++++++++++-------- .../ii/modules/settings/BackgroundConfig.qml | 4 +- 3 files changed, 68 insertions(+), 52 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/common/Config.qml b/dots/.config/quickshell/ii/modules/common/Config.qml index b0b767a44..121f78741 100644 --- a/dots/.config/quickshell/ii/modules/common/Config.qml +++ b/dots/.config/quickshell/ii/modules/common/Config.qml @@ -208,7 +208,7 @@ Singleton { 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 real workspaceZoom: 1.0 // Relative to wallpaper size property bool enableSidebar: true property real widgetsFactor: 1.2 } diff --git a/dots/.config/quickshell/ii/modules/ii/background/Background.qml b/dots/.config/quickshell/ii/modules/ii/background/Background.qml index 68d8b1698..f9ffe54d2 100644 --- a/dots/.config/quickshell/ii/modules/ii/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/ii/background/Background.qml @@ -37,6 +37,7 @@ Variants { property list relevantWindows: HyprlandData.windowList.filter(win => win.monitor == monitor?.id && win.workspace.id >= 0).sort((a, b) => a.workspace.id - b.workspace.id) property int firstWorkspaceId: relevantWindows[0]?.workspace.id || 1 property int lastWorkspaceId: relevantWindows[relevantWindows.length - 1]?.workspace.id || 10 + property int totalWorkspaces: Config?.options.bar.workspaces.shown ?? 10 // Wallpaper property bool wallpaperIsVideo: Config.options.background.wallpaperPath.endsWith(".mp4") || Config.options.background.wallpaperPath.endsWith(".webm") || Config.options.background.wallpaperPath.endsWith(".mkv") || Config.options.background.wallpaperPath.endsWith(".avi") || Config.options.background.wallpaperPath.endsWith(".mov") property string wallpaperPath: wallpaperIsVideo ? Config.options.background.thumbnailPath : Config.options.background.wallpaperPath @@ -46,13 +47,15 @@ Variants { const sensitiveNetwork = (CF.StringUtils.stringListContainsSubstring(Network.networkName.toLowerCase(), Config.options.workSafety.triggerCondition.networkNameKeywords)); return enabled && sensitiveWallpaper && sensitiveNetwork; } - property real wallpaperToScreenRatio: Math.min(wallpaperWidth / screen.width, wallpaperHeight / screen.height) - property real preferredWallpaperScale: Config.options.background.parallax.workspaceZoom + property real parallaxRation: 1.2 + property real additionalScaleFactor: Config.options.background.parallax.workspaceZoom property real effectiveWallpaperScale: 1 // Some reasonable init value, to be updated property int wallpaperWidth: modelData.width // Some reasonable init value, to be updated 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 + property real scaledWallpaperWidth: wallpaperWidth * effectiveWallpaperScale + property real scaledWallpaperHeight: wallpaperHeight * effectiveWallpaperScale + property real parallaxTotalPixelsX: Math.max(screen.width - scaledWallpaperWidth, scaledWallpaperWidth - screen.width) + property real parallaxTotalPixelsY: Math.max(screen.height - scaledWallpaperHeight, scaledWallpaperHeight - screen.height) readonly property bool verticalParallax: (Config.options.background.parallax.autoVertical && wallpaperHeight > wallpaperWidth) || Config.options.background.parallax.vertical // Colors property bool shouldBlur: (GlobalStates.screenLocked && Config.options.lock.blur.enable) @@ -111,13 +114,13 @@ Variants { bgRoot.wallpaperWidth = width; bgRoot.wallpaperHeight = height; - if (width <= screenWidth || height <= screenHeight) { - // Undersized/perfectly sized wallpapers - bgRoot.effectiveWallpaperScale = Math.max(screenWidth / width, screenHeight / height); - } else { - // Oversized = can be zoomed for parallax, yay - bgRoot.effectiveWallpaperScale = Math.min(bgRoot.preferredWallpaperScale, width / screenWidth, height / screenHeight); - } + // Perfect image; scale = 1 + // Small picture; scale > 1; will zoom in the picture + // Big picture; scale < 1; will zoom out the picture + // Choose max number so every side will fit + const minSuitableScale = Math.max(screenWidth / width, screenHeight / height); + //todo switch off parallax + bgRoot.effectiveWallpaperScale = minSuitableScale * bgRoot.additionalScaleFactor * bgRoot.parallaxRation; } } } @@ -133,32 +136,49 @@ Variants { opacity: (status === Image.Ready && !bgRoot.wallpaperIsVideo) ? 1 : 0 cache: false smooth: false - // Range = groups that workspaces span on - property int chunkSize: Config?.options.bar.workspaces.shown ?? 10 - property int lower: Math.floor(bgRoot.firstWorkspaceId / chunkSize) * chunkSize - property int upper: Math.ceil(bgRoot.lastWorkspaceId / chunkSize) * chunkSize - property int range: upper - lower - property real valueX: { - let result = 0.5; + + property int workspaceIndex: (bgRoot.monitor.activeWorkspace?.id ?? 1) - 1 + property real middleFraction: 0.5 + property real fraction: { + // 0 - start of the picture + // 1 - end of the picture + if (bgRoot.totalWorkspaces <= 1) { + return middleFraction; + } + return Math.max(0, Math.min(1, workspaceIndex / (bgRoot.totalWorkspaces - 1))); + } + + x: { + if (bgRoot.screen.width > bgRoot.scaledWallpaperWidth) { + // Center the picture + return bgRoot.parallaxTotalPixelsX / 2; + } + + let usedFraction = middleFraction; if (Config.options.background.parallax.enableWorkspace && !bgRoot.verticalParallax) { - result = ((bgRoot.monitor.activeWorkspace?.id - lower) / range); + usedFraction = fraction; } if (Config.options.background.parallax.enableSidebar) { - result += (0.15 * GlobalStates.sidebarRightOpen - 0.15 * GlobalStates.sidebarLeftOpen); + let sidebarFraction = bgRoot.parallaxRation / 10; + usedFraction += (sidebarFraction * GlobalStates.sidebarRightOpen - sidebarFraction * GlobalStates.sidebarLeftOpen); } - return result; + usedFraction = Math.max(0, Math.min(1, usedFraction)); + return - bgRoot.parallaxTotalPixelsX * usedFraction; } - property real valueY: { - let result = 0.5; + y: { + if (bgRoot.screen.height > bgRoot.scaledWallpaperHeight) { + // Center the picture + return bgRoot.parallaxTotalPixelsY / 2; + } + + let usedFraction = middleFraction; if (Config.options.background.parallax.enableWorkspace && bgRoot.verticalParallax) { - result = ((bgRoot.monitor.activeWorkspace?.id - lower) / range); + usedFraction = fraction; } - return result; + usedFraction = Math.max(0, Math.min(1, usedFraction)); + return - bgRoot.parallaxTotalPixelsY * usedFraction; } - property real effectiveValueX: Math.max(0, Math.min(1, valueX)) - 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: bgRoot.wallpaperSafetyTriggered ? "" : bgRoot.wallpaperPath fillMode: Image.PreserveAspectCrop Behavior on x { @@ -174,11 +194,11 @@ Variants { } } sourceSize { - width: bgRoot.screen.width * bgRoot.effectiveWallpaperScale * bgRoot.monitor.scale - height: bgRoot.screen.height * bgRoot.effectiveWallpaperScale * bgRoot.monitor.scale + width: bgRoot.scaledWallpaperWidth + height: bgRoot.scaledWallpaperHeight } - width: bgRoot.wallpaperWidth / bgRoot.wallpaperToScreenRatio * bgRoot.effectiveWallpaperScale - height: bgRoot.wallpaperHeight / bgRoot.wallpaperToScreenRatio * bgRoot.effectiveWallpaperScale + width: bgRoot.scaledWallpaperWidth + height: bgRoot.scaledWallpaperHeight } Loader { @@ -210,22 +230,18 @@ Variants { WidgetCanvas { id: widgetCanvas anchors { - left: wallpaper.left - right: wallpaper.right - top: wallpaper.top - bottom: wallpaper.bottom + left: bgRoot.screen.left + right: bgRoot.screen.right + top: bgRoot.screen.top + bottom: bgRoot.screen.bottom horizontalCenter: undefined verticalCenter: undefined readonly property real parallaxFactor: Config.options.background.parallax.widgetsFactor leftMargin: { - const xOnWallpaper = bgRoot.movableXSpace; - const extraMove = (wallpaper.effectiveValueX * 2 * bgRoot.movableXSpace) * (parallaxFactor - 1); - return xOnWallpaper - extraMove; + return bgRoot.screen.width * 0.2; } topMargin: { - const yOnWallpaper = bgRoot.movableYSpace; - const extraMove = (wallpaper.effectiveValueY * 2 * bgRoot.movableYSpace) * (parallaxFactor - 1); - return yOnWallpaper - extraMove; + return bgRoot.screen.height * 0.2; } Behavior on leftMargin { animation: Appearance.animation.elementMove.numberAnimation.createObject(this) @@ -275,9 +291,9 @@ Variants { sourceComponent: WeatherWidget { screenWidth: bgRoot.screen.width screenHeight: bgRoot.screen.height - scaledScreenWidth: bgRoot.screen.width / bgRoot.effectiveWallpaperScale - scaledScreenHeight: bgRoot.screen.height / bgRoot.effectiveWallpaperScale - wallpaperScale: bgRoot.effectiveWallpaperScale + scaledScreenWidth: bgRoot.screen.width + scaledScreenHeight: bgRoot.screen.height + wallpaperScale: 1 } } @@ -286,9 +302,9 @@ Variants { sourceComponent: ClockWidget { screenWidth: bgRoot.screen.width screenHeight: bgRoot.screen.height - scaledScreenWidth: bgRoot.screen.width / bgRoot.effectiveWallpaperScale - scaledScreenHeight: bgRoot.screen.height / bgRoot.effectiveWallpaperScale - wallpaperScale: bgRoot.effectiveWallpaperScale + scaledScreenWidth: bgRoot.screen.width + scaledScreenHeight: bgRoot.screen.height + wallpaperScale: 1 wallpaperSafetyTriggered: bgRoot.wallpaperSafetyTriggered } } diff --git a/dots/.config/quickshell/ii/modules/settings/BackgroundConfig.qml b/dots/.config/quickshell/ii/modules/settings/BackgroundConfig.qml index 66630cc24..86debf5d7 100644 --- a/dots/.config/quickshell/ii/modules/settings/BackgroundConfig.qml +++ b/dots/.config/quickshell/ii/modules/settings/BackgroundConfig.qml @@ -43,8 +43,8 @@ ContentPage { icon: "loupe" text: Translation.tr("Preferred wallpaper zoom (%)") value: Config.options.background.parallax.workspaceZoom * 100 - from: 100 - to: 150 + from: 10 + to: 200 stepSize: 1 onValueChanged: { Config.options.background.parallax.workspaceZoom = value / 100; From 1efd2dfa19b5fa84aaf871ec16d729ed23d40c76 Mon Sep 17 00:00:00 2001 From: EoinKanro <54404008+EoinKanro@users.noreply.github.com> Date: Thu, 4 Dec 2025 22:47:50 +0100 Subject: [PATCH 2/8] Remove todo and make readonly additionalScaleFactor --- .../.config/quickshell/ii/modules/ii/background/Background.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/ii/background/Background.qml b/dots/.config/quickshell/ii/modules/ii/background/Background.qml index f9ffe54d2..06f40f26b 100644 --- a/dots/.config/quickshell/ii/modules/ii/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/ii/background/Background.qml @@ -48,7 +48,7 @@ Variants { return enabled && sensitiveWallpaper && sensitiveNetwork; } property real parallaxRation: 1.2 - property real additionalScaleFactor: Config.options.background.parallax.workspaceZoom + readonly property real additionalScaleFactor: Config.options.background.parallax.workspaceZoom property real effectiveWallpaperScale: 1 // Some reasonable init value, to be updated property int wallpaperWidth: modelData.width // Some reasonable init value, to be updated property int wallpaperHeight: modelData.height // Some reasonable init value, to be updated @@ -119,7 +119,6 @@ Variants { // Big picture; scale < 1; will zoom out the picture // Choose max number so every side will fit const minSuitableScale = Math.max(screenWidth / width, screenHeight / height); - //todo switch off parallax bgRoot.effectiveWallpaperScale = minSuitableScale * bgRoot.additionalScaleFactor * bgRoot.parallaxRation; } } From 758c84feafd5b7bb53cd57bb087feb94565e58b0 Mon Sep 17 00:00:00 2001 From: EoinKanro <54404008+EoinKanro@users.noreply.github.com> Date: Thu, 4 Dec 2025 23:47:08 +0100 Subject: [PATCH 3/8] Make readonly parallaxRation --- dots/.config/quickshell/ii/modules/ii/background/Background.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dots/.config/quickshell/ii/modules/ii/background/Background.qml b/dots/.config/quickshell/ii/modules/ii/background/Background.qml index 06f40f26b..8ff970889 100644 --- a/dots/.config/quickshell/ii/modules/ii/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/ii/background/Background.qml @@ -47,7 +47,7 @@ Variants { const sensitiveNetwork = (CF.StringUtils.stringListContainsSubstring(Network.networkName.toLowerCase(), Config.options.workSafety.triggerCondition.networkNameKeywords)); return enabled && sensitiveWallpaper && sensitiveNetwork; } - property real parallaxRation: 1.2 + readonly property real parallaxRation: 1.2 readonly property real additionalScaleFactor: Config.options.background.parallax.workspaceZoom property real effectiveWallpaperScale: 1 // Some reasonable init value, to be updated property int wallpaperWidth: modelData.width // Some reasonable init value, to be updated From ead056c20776882c074d005c3ef1ccfc6c41e46e Mon Sep 17 00:00:00 2001 From: Ivan Rosinskii <54404008+EoinKanro@users.noreply.github.com> Date: Fri, 5 Dec 2025 17:41:12 +0100 Subject: [PATCH 4/8] Fix widgets and decrease parallaxRation --- .../ii/modules/ii/background/Background.qml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/ii/background/Background.qml b/dots/.config/quickshell/ii/modules/ii/background/Background.qml index 8ff970889..07b53e4e9 100644 --- a/dots/.config/quickshell/ii/modules/ii/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/ii/background/Background.qml @@ -47,7 +47,7 @@ Variants { const sensitiveNetwork = (CF.StringUtils.stringListContainsSubstring(Network.networkName.toLowerCase(), Config.options.workSafety.triggerCondition.networkNameKeywords)); return enabled && sensitiveWallpaper && sensitiveNetwork; } - readonly property real parallaxRation: 1.2 + readonly property real parallaxRation: 1.1 readonly property real additionalScaleFactor: Config.options.background.parallax.workspaceZoom property real effectiveWallpaperScale: 1 // Some reasonable init value, to be updated property int wallpaperWidth: modelData.width // Some reasonable init value, to be updated @@ -229,19 +229,13 @@ Variants { WidgetCanvas { id: widgetCanvas anchors { - left: bgRoot.screen.left - right: bgRoot.screen.right - top: bgRoot.screen.top - bottom: bgRoot.screen.bottom + left: wallpaper.left + right: wallpaper.right + top: wallpaper.top + bottom: wallpaper.bottom horizontalCenter: undefined verticalCenter: undefined readonly property real parallaxFactor: Config.options.background.parallax.widgetsFactor - leftMargin: { - return bgRoot.screen.width * 0.2; - } - topMargin: { - return bgRoot.screen.height * 0.2; - } Behavior on leftMargin { animation: Appearance.animation.elementMove.numberAnimation.createObject(this) } From 52d6e8a5d1bbb9caabdb8fb570a17aaaf1dfb37a Mon Sep 17 00:00:00 2001 From: Ivan Rosinskii <54404008+EoinKanro@users.noreply.github.com> Date: Fri, 5 Dec 2025 18:07:40 +0100 Subject: [PATCH 5/8] Fix sourceSize quality --- .../quickshell/ii/modules/ii/background/Background.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/ii/background/Background.qml b/dots/.config/quickshell/ii/modules/ii/background/Background.qml index 07b53e4e9..c5176343b 100644 --- a/dots/.config/quickshell/ii/modules/ii/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/ii/background/Background.qml @@ -193,8 +193,8 @@ Variants { } } sourceSize { - width: bgRoot.scaledWallpaperWidth - height: bgRoot.scaledWallpaperHeight + width: Math.max(bgRoot.wallpaperWidth, bgRoot.wallpaperWidth / bgRoot.parallaxRation) + height: Math.max(bgRoot.wallpaperHeight, bgRoot.wallpaperHeight / bgRoot.parallaxRation) } width: bgRoot.scaledWallpaperWidth height: bgRoot.scaledWallpaperHeight From ddf1bc6a08db2ee10ecf323a0414ad2c26bc9453 Mon Sep 17 00:00:00 2001 From: EoinKanro <54404008+EoinKanro@users.noreply.github.com> Date: Sat, 6 Dec 2025 00:53:07 +0100 Subject: [PATCH 6/8] Remove tricky calculations and fix sourceSize --- .../ii/modules/ii/background/Background.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/ii/background/Background.qml b/dots/.config/quickshell/ii/modules/ii/background/Background.qml index c5176343b..afa2731d2 100644 --- a/dots/.config/quickshell/ii/modules/ii/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/ii/background/Background.qml @@ -54,8 +54,8 @@ Variants { property int wallpaperHeight: modelData.height // Some reasonable init value, to be updated property real scaledWallpaperWidth: wallpaperWidth * effectiveWallpaperScale property real scaledWallpaperHeight: wallpaperHeight * effectiveWallpaperScale - property real parallaxTotalPixelsX: Math.max(screen.width - scaledWallpaperWidth, scaledWallpaperWidth - screen.width) - property real parallaxTotalPixelsY: Math.max(screen.height - scaledWallpaperHeight, scaledWallpaperHeight - screen.height) + property real parallaxTotalPixelsX: Math.max(0, scaledWallpaperWidth - screen.width) + property real parallaxTotalPixelsY: Math.max(0, scaledWallpaperHeight - screen.height) readonly property bool verticalParallax: (Config.options.background.parallax.autoVertical && wallpaperHeight > wallpaperWidth) || Config.options.background.parallax.vertical // Colors property bool shouldBlur: (GlobalStates.screenLocked && Config.options.lock.blur.enable) @@ -150,7 +150,7 @@ Variants { x: { if (bgRoot.screen.width > bgRoot.scaledWallpaperWidth) { // Center the picture - return bgRoot.parallaxTotalPixelsX / 2; + return (bgRoot.screen.width - bgRoot.scaledWallpaperWidth) / 2; } let usedFraction = middleFraction; @@ -167,7 +167,7 @@ Variants { y: { if (bgRoot.screen.height > bgRoot.scaledWallpaperHeight) { // Center the picture - return bgRoot.parallaxTotalPixelsY / 2; + return (bgRoot.screen.height - bgRoot.scaledWallpaperHeight) / 2; } let usedFraction = middleFraction; @@ -193,8 +193,8 @@ Variants { } } sourceSize { - width: Math.max(bgRoot.wallpaperWidth, bgRoot.wallpaperWidth / bgRoot.parallaxRation) - height: Math.max(bgRoot.wallpaperHeight, bgRoot.wallpaperHeight / bgRoot.parallaxRation) + width: bgRoot.scaledWallpaperWidth + height: bgRoot.scaledWallpaperHeight } width: bgRoot.scaledWallpaperWidth height: bgRoot.scaledWallpaperHeight From 4408b5d9d328e645f92d0925ef290efe12cec948 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Thu, 2 Apr 2026 22:22:35 +0200 Subject: [PATCH 7/8] fix not working with more than 10 workspaces --- .../.config/quickshell/ii/modules/ii/background/Background.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dots/.config/quickshell/ii/modules/ii/background/Background.qml b/dots/.config/quickshell/ii/modules/ii/background/Background.qml index afa2731d2..667735a22 100644 --- a/dots/.config/quickshell/ii/modules/ii/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/ii/background/Background.qml @@ -37,7 +37,8 @@ Variants { property list relevantWindows: HyprlandData.windowList.filter(win => win.monitor == monitor?.id && win.workspace.id >= 0).sort((a, b) => a.workspace.id - b.workspace.id) property int firstWorkspaceId: relevantWindows[0]?.workspace.id || 1 property int lastWorkspaceId: relevantWindows[relevantWindows.length - 1]?.workspace.id || 10 - property int totalWorkspaces: Config?.options.bar.workspaces.shown ?? 10 + property int workspaceChunkSize: Config?.options.bar.workspaces.shown ?? 10 + property int totalWorkspaces: Math.ceil(lastWorkspaceId / workspaceChunkSize) * workspaceChunkSize // Wallpaper property bool wallpaperIsVideo: Config.options.background.wallpaperPath.endsWith(".mp4") || Config.options.background.wallpaperPath.endsWith(".webm") || Config.options.background.wallpaperPath.endsWith(".mkv") || Config.options.background.wallpaperPath.endsWith(".avi") || Config.options.background.wallpaperPath.endsWith(".mov") property string wallpaperPath: wallpaperIsVideo ? Config.options.background.thumbnailPath : Config.options.background.wallpaperPath From dfe9c876d2bf9ab4f8e1f435f8ab630203242031 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Thu, 2 Apr 2026 22:46:52 +0200 Subject: [PATCH 8/8] fix widget parallax --- .../ii/modules/ii/background/Background.qml | 85 +++++++------------ 1 file changed, 32 insertions(+), 53 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/ii/background/Background.qml b/dots/.config/quickshell/ii/modules/ii/background/Background.qml index 667735a22..b63ba8862 100644 --- a/dots/.config/quickshell/ii/modules/ii/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/ii/background/Background.qml @@ -127,7 +127,6 @@ Variants { Item { anchors.fill: parent - clip: true // Wallpaper StyledImage { @@ -148,35 +147,38 @@ Variants { return Math.max(0, Math.min(1, workspaceIndex / (bgRoot.totalWorkspaces - 1))); } - x: { - if (bgRoot.screen.width > bgRoot.scaledWallpaperWidth) { - // Center the picture - return (bgRoot.screen.width - bgRoot.scaledWallpaperWidth) / 2; - } - + property real usedFractionX: { let usedFraction = middleFraction; if (Config.options.background.parallax.enableWorkspace && !bgRoot.verticalParallax) { usedFraction = fraction; } if (Config.options.background.parallax.enableSidebar) { - let sidebarFraction = bgRoot.parallaxRation / 10; + let sidebarFraction = bgRoot.parallaxRation / bgRoot.workspaceChunkSize / 2; usedFraction += (sidebarFraction * GlobalStates.sidebarRightOpen - sidebarFraction * GlobalStates.sidebarLeftOpen); } - usedFraction = Math.max(0, Math.min(1, usedFraction)); - return - bgRoot.parallaxTotalPixelsX * usedFraction; + return Math.max(0, Math.min(1, usedFraction)); + } + property real usedFractionY: { + let usedFraction = middleFraction; + if (Config.options.background.parallax.enableWorkspace && bgRoot.verticalParallax) { + usedFraction = fraction; + } + return Math.max(0, Math.min(1, usedFraction)); + } + + x: { + if (bgRoot.screen.width > bgRoot.scaledWallpaperWidth) { + // Center the picture + return (bgRoot.screen.width - bgRoot.scaledWallpaperWidth) / 2; + } + return - bgRoot.parallaxTotalPixelsX * usedFractionX; } y: { if (bgRoot.screen.height > bgRoot.scaledWallpaperHeight) { // Center the picture return (bgRoot.screen.height - bgRoot.scaledWallpaperHeight) / 2; } - - let usedFraction = middleFraction; - if (Config.options.background.parallax.enableWorkspace && bgRoot.verticalParallax) { - usedFraction = fraction; - } - usedFraction = Math.max(0, Math.min(1, usedFraction)); - return - bgRoot.parallaxTotalPixelsY * usedFraction; + return - bgRoot.parallaxTotalPixelsY * usedFractionY; } source: bgRoot.wallpaperSafetyTriggered ? "" : bgRoot.wallpaperPath @@ -229,43 +231,20 @@ Variants { WidgetCanvas { id: widgetCanvas - anchors { - left: wallpaper.left - right: wallpaper.right - top: wallpaper.top - bottom: wallpaper.bottom - horizontalCenter: undefined - verticalCenter: undefined - readonly property real parallaxFactor: Config.options.background.parallax.widgetsFactor - Behavior on leftMargin { - animation: Appearance.animation.elementMove.numberAnimation.createObject(this) - } - Behavior on topMargin { - animation: Appearance.animation.elementMove.numberAnimation.createObject(this) - } - } - width: wallpaper.width - height: wallpaper.height - states: State { - name: "centered" - when: GlobalStates.screenLocked || bgRoot.wallpaperSafetyTriggered - PropertyChanges { - target: widgetCanvas - width: parent.width - height: parent.height - } - AnchorChanges { - target: widgetCanvas - anchors { - left: undefined - right: undefined - top: undefined - bottom: undefined - horizontalCenter: parent.horizontalCenter - verticalCenter: parent.verticalCenter - } - } + width: parent.width + height: parent.height + readonly property real parallaxFactor: { + var f = Config.options.background.parallax.widgetsFactor; + return f / Config.options.background.parallax.workspaceZoom; } + readonly property real baseWallpaperOffsetX: (bgRoot.screen.width - bgRoot.scaledWallpaperWidth) / 2 + readonly property real baseWallpaperOffsetY: (bgRoot.screen.height - bgRoot.scaledWallpaperHeight) / 2 + readonly property real wallpaperTotalOffsetX: wallpaper.x - baseWallpaperOffsetX + readonly property real wallpaperTotalOffsetY: wallpaper.y - baseWallpaperOffsetY + readonly property bool locked: GlobalStates.screenLocked + x: wallpaperTotalOffsetX * parallaxFactor * !locked + y: wallpaperTotalOffsetY * parallaxFactor * !locked + transitions: Transition { PropertyAnimation { properties: "width,height"