fix times getting stuck after suspend
This commit is contained in:
parent
ab8a5b9a3a
commit
ad1ee4cfc4
4 changed files with 25 additions and 13 deletions
|
|
@ -5,18 +5,13 @@ import Quickshell
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: "black"
|
color: "black"
|
||||||
|
|
||||||
SystemClock {
|
|
||||||
id: clock
|
|
||||||
precision: SystemClock.Minutes
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: 16
|
leftMargin: 16
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
text: Qt.formatDateTime(clock.date, "HH:mm")
|
text: Qt.formatDateTime(Time.date, "HH:mm")
|
||||||
color: Theme.text
|
color: Theme.text
|
||||||
font.family: Theme.font
|
font.family: Theme.font
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,6 @@ WlSessionLockSurface {
|
||||||
brightness: -0.05
|
brightness: -0.05
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemClock {
|
|
||||||
id: clock
|
|
||||||
precision: SystemClock.Minutes
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: surface.lock
|
target: surface.lock
|
||||||
|
|
||||||
|
|
@ -77,7 +72,7 @@ WlSessionLockSurface {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: Qt.formatTime(clock.date, "HH:mm")
|
text: Qt.formatTime(Time.date, "HH:mm")
|
||||||
color: Theme.text
|
color: Theme.text
|
||||||
font.family: Theme.font
|
font.family: Theme.font
|
||||||
font.pixelSize: 88
|
font.pixelSize: 88
|
||||||
|
|
@ -86,7 +81,7 @@ WlSessionLockSurface {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: Qt.formatDate(clock.date, "dddd, MMMM d")
|
text: Qt.formatDate(Time.date, "dddd, MMMM d")
|
||||||
color: Theme.subtext
|
color: Theme.subtext
|
||||||
font.family: Theme.font
|
font.family: Theme.font
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
|
|
|
||||||
21
src/Time.qml
Normal file
21
src/Time.qml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property date date: new Date()
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 1000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
onTriggered: {
|
||||||
|
const now = new Date();
|
||||||
|
if (now.getMinutes() !== root.date.getMinutes() || now.getHours() !== root.date.getHours() || now.getDate() !== root.date.getDate())
|
||||||
|
root.date = now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
singleton Notifications Notifications.qml
|
singleton Notifications Notifications.qml
|
||||||
singleton Status Status.qml
|
singleton Status Status.qml
|
||||||
singleton Theme Theme.qml
|
singleton Theme Theme.qml
|
||||||
|
singleton Time Time.qml
|
||||||
Bar Bar.qml
|
Bar Bar.qml
|
||||||
Lock Lock.qml
|
Lock Lock.qml
|
||||||
LockSurface LockSurface.qml
|
LockSurface LockSurface.qml
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue