dashboard: add datetime

This commit is contained in:
2 * r + 2 * t 2025-05-18 11:42:16 +08:00
parent ef9431bb36
commit c6a389120d
3 changed files with 77 additions and 5 deletions

View file

@ -11,5 +11,6 @@ Singleton {
readonly property int tabIndicatorSpacing: 5
readonly property int infoWidth: 200
readonly property int infoIconSize: 25
readonly property int dateTimeWidth: 110
}
}

View file

@ -26,11 +26,9 @@ GridLayout {
}
Rect {
text: "time"
Layout.row: 1
Layout.preferredWidth: 100
Layout.fillHeight: true
DateTime {}
}
Rect {
@ -40,7 +38,7 @@ GridLayout {
Layout.column: 1
Layout.columnSpan: 3
Layout.fillWidth: true
Layout.preferredHeight: 200
Layout.fillHeight: true
}
Rect {

View file

@ -0,0 +1,73 @@
import "root:/widgets"
import "root:/services"
import "root:/config"
import Quickshell
import Quickshell.Io
import Quickshell.Widgets
import QtQuick
Item {
id: root
implicitWidth: DashboardConfig.sizes.dateTimeWidth
implicitHeight: date.y + date.implicitHeight + Appearance.padding.large * 2
StyledText {
id: hours
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: Appearance.padding.large * 2
horizontalAlignment: Text.AlignHCenter
text: Time.format("HH")
color: Colours.palette.m3secondary
font.pointSize: Appearance.font.size.extraLarge
font.weight: 500
}
StyledText {
id: sep
anchors.left: parent.left
anchors.right: parent.right
anchors.top: hours.bottom
anchors.topMargin: -font.pointSize * 0.5
horizontalAlignment: Text.AlignHCenter
text: "•••"
color: Colours.palette.m3primary
font.pointSize: Appearance.font.size.extraLarge * 0.9
}
StyledText {
id: mins
anchors.left: parent.left
anchors.right: parent.right
anchors.top: sep.bottom
anchors.topMargin: -sep.font.pointSize * 0.45
horizontalAlignment: Text.AlignHCenter
text: Time.format("MM")
color: Colours.palette.m3secondary
font.pointSize: Appearance.font.size.extraLarge
font.weight: 500
}
StyledText {
id: date
anchors.left: parent.left
anchors.right: parent.right
anchors.top: mins.bottom
anchors.topMargin: Appearance.spacing.normal
horizontalAlignment: Text.AlignHCenter
text: Time.format("ddd, d")
color: Colours.palette.m3tertiary
font.pointSize: Appearance.font.size.normal
font.weight: 500
}
}