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"