config options: add fixed bg clock pos

This commit is contained in:
end-4
2025-06-16 23:41:45 +02:00
parent 5dfa1b3445
commit 00b1aa1222
2 changed files with 21 additions and 11 deletions
@@ -15,8 +15,12 @@ import Quickshell.Services.UPower
Scope { Scope {
id: root id: root
property string filePath: `${Directories.state}/user/generated/wallpaper/least_busy_region.json` property string filePath: `${Directories.state}/user/generated/wallpaper/least_busy_region.json`
property real centerX: -500 property real defaultX: (ConfigOptions?.background.clockX ?? -500)
property real centerY: -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 color dominantColor: Appearance.colors.colPrimary
property bool dominantColorIsDark: dominantColor.hslLightness < 0.5 property bool dominantColorIsDark: dominantColor.hslLightness < 0.5
property color colBackground: ColorUtils.transparentize(ColorUtils.mix(Appearance.colors.colPrimary, Appearance.colors.colSecondaryContainer), 1) property color colBackground: ColorUtils.transparentize(ColorUtils.mix(Appearance.colors.colPrimary, Appearance.colors.colSecondaryContainer), 1)
@@ -42,7 +46,7 @@ Scope {
FileView { FileView {
id: leastBusyRegionFileView id: leastBusyRegionFileView
path: Qt.resolvedUrl(root.filePath) path: Qt.resolvedUrl(root.filePath)
watchChanges: true watchChanges: !ConfigOptions?.background.fixedClockPosition
onFileChanged: { onFileChanged: {
this.reload() this.reload()
delayedFileRead.start() delayedFileRead.start()
@@ -63,8 +67,8 @@ Scope {
component: PanelWindow { // Window component: PanelWindow { // Window
id: windowRoot id: windowRoot
screen: modelData screen: modelData
property var textHorizontalAlignment: root.centerX / monitor.scale < windowRoot.width / 3 ? Text.AlignLeft : property var textHorizontalAlignment: root.effectiveCenterX / monitor.scale < windowRoot.width / 3 ? Text.AlignLeft :
(root.centerX / monitor.scale > windowRoot.width * 2 / 3 ? Text.AlignRight : Text.AlignHCenter) (root.effectiveCenterX / monitor.scale > windowRoot.width * 2 / 3 ? Text.AlignRight : Text.AlignHCenter)
WlrLayershell.layer: WlrLayer.Bottom WlrLayershell.layer: WlrLayer.Bottom
WlrLayershell.namespace: "quickshell:backgroundWidgets" WlrLayershell.namespace: "quickshell:backgroundWidgets"
@@ -91,8 +95,8 @@ Scope {
anchors { anchors {
left: parent.left left: parent.left
top: parent.top top: parent.top
leftMargin: (root.centerX / monitor.scale - implicitWidth / 2) leftMargin: (root.effectiveCenterX / monitor.scale - implicitWidth / 2)
topMargin: (root.centerY / monitor.scale - implicitHeight / 2) topMargin: (root.effectiveCenterY / monitor.scale - implicitHeight / 2)
Behavior on leftMargin { Behavior on leftMargin {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this) animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
} }
@@ -39,10 +39,10 @@ Singleton {
property string terminal: "kitty -1" // This is only for shell actions property string terminal: "kitty -1" // This is only for shell actions
} }
property QtObject battery: QtObject { property QtObject background: QtObject {
property int low: 20 property bool fixedClockPosition: false
property int critical: 5 property real clockX: -500
property int suspend: 2 property real clockY: -500
} }
property QtObject bar: QtObject { 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 QtObject dock: QtObject {
property real height: 60 property real height: 60
property real hoverRegionHeight: 3 property real hoverRegionHeight: 3