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 {
|
||||
color: "black"
|
||||
|
||||
SystemClock {
|
||||
id: clock
|
||||
precision: SystemClock.Minutes
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 16
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: Qt.formatDateTime(clock.date, "HH:mm")
|
||||
text: Qt.formatDateTime(Time.date, "HH:mm")
|
||||
color: Theme.text
|
||||
font.family: Theme.font
|
||||
font.pixelSize: 13
|
||||
|
|
|
|||
|
|
@ -38,11 +38,6 @@ WlSessionLockSurface {
|
|||
brightness: -0.05
|
||||
}
|
||||
|
||||
SystemClock {
|
||||
id: clock
|
||||
precision: SystemClock.Minutes
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: surface.lock
|
||||
|
||||
|
|
@ -77,7 +72,7 @@ WlSessionLockSurface {
|
|||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: Qt.formatTime(clock.date, "HH:mm")
|
||||
text: Qt.formatTime(Time.date, "HH:mm")
|
||||
color: Theme.text
|
||||
font.family: Theme.font
|
||||
font.pixelSize: 88
|
||||
|
|
@ -86,7 +81,7 @@ WlSessionLockSurface {
|
|||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: Qt.formatDate(clock.date, "dddd, MMMM d")
|
||||
text: Qt.formatDate(Time.date, "dddd, MMMM d")
|
||||
color: Theme.subtext
|
||||
font.family: Theme.font
|
||||
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 Status Status.qml
|
||||
singleton Theme Theme.qml
|
||||
singleton Time Time.qml
|
||||
Bar Bar.qml
|
||||
Lock Lock.qml
|
||||
LockSurface LockSurface.qml
|
||||
|
|
|
|||
Loading…
Reference in a new issue