From 00b1aa1222604ae97d5aa8b929696b8a84516356 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 16 Jun 2025 23:41:45 +0200 Subject: [PATCH] config options: add fixed bg clock pos --- .../backgroundWidgets/BackgroundWidgets.qml | 18 +++++++++++------- .../modules/common/ConfigOptions.qml | 14 ++++++++++---- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.config/quickshell/modules/backgroundWidgets/BackgroundWidgets.qml b/.config/quickshell/modules/backgroundWidgets/BackgroundWidgets.qml index bf28095e4..77e036f1b 100644 --- a/.config/quickshell/modules/backgroundWidgets/BackgroundWidgets.qml +++ b/.config/quickshell/modules/backgroundWidgets/BackgroundWidgets.qml @@ -15,8 +15,12 @@ import Quickshell.Services.UPower Scope { id: root property string filePath: `${Directories.state}/user/generated/wallpaper/least_busy_region.json` - property real centerX: -500 - property real centerY: -500 + property real defaultX: (ConfigOptions?.background.clockX ?? -500) + property real defaultY: (ConfigOptions?.background.clockY ?? -500) + property real centerX: defaultX + property real centerY: defaultY + property real effectiveCenterX: ConfigOptions?.background.fixedClockPosition ? defaultX : centerX + property real effectiveCenterY: ConfigOptions?.background.fixedClockPosition ? defaultY : centerY property color dominantColor: Appearance.colors.colPrimary property bool dominantColorIsDark: dominantColor.hslLightness < 0.5 property color colBackground: ColorUtils.transparentize(ColorUtils.mix(Appearance.colors.colPrimary, Appearance.colors.colSecondaryContainer), 1) @@ -42,7 +46,7 @@ Scope { FileView { id: leastBusyRegionFileView path: Qt.resolvedUrl(root.filePath) - watchChanges: true + watchChanges: !ConfigOptions?.background.fixedClockPosition onFileChanged: { this.reload() delayedFileRead.start() @@ -63,8 +67,8 @@ Scope { component: PanelWindow { // Window id: windowRoot screen: modelData - property var textHorizontalAlignment: root.centerX / monitor.scale < windowRoot.width / 3 ? Text.AlignLeft : - (root.centerX / monitor.scale > windowRoot.width * 2 / 3 ? Text.AlignRight : Text.AlignHCenter) + property var textHorizontalAlignment: root.effectiveCenterX / monitor.scale < windowRoot.width / 3 ? Text.AlignLeft : + (root.effectiveCenterX / monitor.scale > windowRoot.width * 2 / 3 ? Text.AlignRight : Text.AlignHCenter) WlrLayershell.layer: WlrLayer.Bottom WlrLayershell.namespace: "quickshell:backgroundWidgets" @@ -91,8 +95,8 @@ Scope { anchors { left: parent.left top: parent.top - leftMargin: (root.centerX / monitor.scale - implicitWidth / 2) - topMargin: (root.centerY / monitor.scale - implicitHeight / 2) + leftMargin: (root.effectiveCenterX / monitor.scale - implicitWidth / 2) + topMargin: (root.effectiveCenterY / monitor.scale - implicitHeight / 2) Behavior on leftMargin { animation: Appearance.animation.elementMove.numberAnimation.createObject(this) } diff --git a/.config/quickshell/modules/common/ConfigOptions.qml b/.config/quickshell/modules/common/ConfigOptions.qml index 04607104d..9b848e6ee 100644 --- a/.config/quickshell/modules/common/ConfigOptions.qml +++ b/.config/quickshell/modules/common/ConfigOptions.qml @@ -39,10 +39,10 @@ Singleton { property string terminal: "kitty -1" // This is only for shell actions } - property QtObject battery: QtObject { - property int low: 20 - property int critical: 5 - property int suspend: 2 + property QtObject background: QtObject { + property bool fixedClockPosition: false + property real clockX: -500 + property real clockY: -500 } property QtObject bar: QtObject { @@ -70,6 +70,12 @@ Singleton { } } + property QtObject battery: QtObject { + property int low: 20 + property int critical: 5 + property int suspend: 2 + } + property QtObject dock: QtObject { property real height: 60 property real hoverRegionHeight: 3