From f42e6773aaf782b2992bb32e64fff2e659055a9d Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Thu, 17 Jul 2025 23:44:13 +0700 Subject: [PATCH] settings: add wallpaper parallax --- .../ii/modules/background/Background.qml | 2 +- .../quickshell/ii/modules/bar/BarGroup.qml | 2 -- .../ii/modules/settings/StyleConfig.qml | 33 +++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.config/quickshell/ii/modules/background/Background.qml b/.config/quickshell/ii/modules/background/Background.qml index cf01078c9..0ee66fb21 100644 --- a/.config/quickshell/ii/modules/background/Background.qml +++ b/.config/quickshell/ii/modules/background/Background.qml @@ -144,7 +144,7 @@ Scope { const lower = Math.floor(bgRoot.firstWorkspaceId / chunkSize) * chunkSize; const upper = Math.ceil(bgRoot.lastWorkspaceId / chunkSize) * chunkSize; const range = upper - lower; - return (bgRoot.monitor.activeWorkspace.id - lower) / range + return (Config.options.background.parallax.enableWorkspace ? ((bgRoot.monitor.activeWorkspace.id - lower) / range) : 0.5) + (0.15 * GlobalStates.sidebarRightOpen * Config.options.background.parallax.enableSidebar) - (0.15 * GlobalStates.sidebarLeftOpen * Config.options.background.parallax.enableSidebar) } diff --git a/.config/quickshell/ii/modules/bar/BarGroup.qml b/.config/quickshell/ii/modules/bar/BarGroup.qml index 04e64eb70..e2371d147 100644 --- a/.config/quickshell/ii/modules/bar/BarGroup.qml +++ b/.config/quickshell/ii/modules/bar/BarGroup.qml @@ -1,6 +1,4 @@ import qs.modules.common -import qs.modules.common.widgets -import qs.services import QtQuick import QtQuick.Layouts diff --git a/.config/quickshell/ii/modules/settings/StyleConfig.qml b/.config/quickshell/ii/modules/settings/StyleConfig.qml index ec37c7eb8..6eabfabdc 100644 --- a/.config/quickshell/ii/modules/settings/StyleConfig.qml +++ b/.config/quickshell/ii/modules/settings/StyleConfig.qml @@ -208,5 +208,38 @@ ContentPage { } } } + + ContentSubsection { + title: Translation.tr("Wallpaper parallax") + + ConfigRow { + uniform: true + ConfigSwitch { + text: Translation.tr("Depends on workspace") + checked: Config.options.background.parallax.enableWorkspace + onCheckedChanged: { + Config.options.background.parallax.enableWorkspace = checked; + } + } + ConfigSwitch { + text: Translation.tr("Depends on sidebars") + checked: Config.options.background.parallax.enableSidebar + onCheckedChanged: { + Config.options.background.parallax.enableSidebar = checked; + } + } + } + ConfigSpinBox { + text: Translation.tr("Preferred wallpaper zoom (%)") + value: Config.options.background.parallax.workspaceZoom * 100 + from: 100 + to: 150 + stepSize: 1 + onValueChanged: { + console.log(value/100) + Config.options.background.parallax.workspaceZoom = value / 100; + } + } + } } } \ No newline at end of file