forked from Shinonome/dots-hyprland
cookie clock: cleaner date indicator, adjust colors
This commit is contained in:
+14
-22
@@ -10,6 +10,11 @@ Item {
|
||||
id: root
|
||||
|
||||
property string style: Config.options.background.clock.cookie.dateStyle
|
||||
property color color: Appearance.colors.colOnSecondaryContainer
|
||||
property real angleStep: 12 * Math.PI / 180
|
||||
property string dateText: Qt.locale().toString(DateTime.clock.date, "ddd dd")
|
||||
|
||||
readonly property int clockSecond: DateTime.clock.seconds
|
||||
readonly property string dialStyle: Config.options.background.clock.cookie.dialNumberStyle
|
||||
readonly property bool timeIndicators: Config.options.background.clock.cookie.timeIndicators
|
||||
|
||||
@@ -18,20 +23,9 @@ Item {
|
||||
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
|
||||
}
|
||||
|
||||
property string dateText: Qt.locale().toString(DateTime.clock.date, "ddd dd")
|
||||
property real angleStep: Math.PI / 2.35 / dateText.length
|
||||
|
||||
property color dayColor: Appearance.colors.colSecondary
|
||||
property color monthColor: Appearance.colors.colSecondaryHover
|
||||
|
||||
opacity: style === "rotating" ? 1.0 : 0.0
|
||||
Behavior on opacity {
|
||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||
}
|
||||
|
||||
rotation: {
|
||||
if (!Config.options.time.secondPrecision) return 0
|
||||
else return secondHandLoader.item.rotation + 45 // +45 to center the text
|
||||
else return (360 / 60 * clockSecond) + 180 - (angleStep / Math.PI * 180 * dateText.length) / 2
|
||||
}
|
||||
|
||||
Repeater {
|
||||
@@ -40,20 +34,18 @@ Item {
|
||||
delegate: Text {
|
||||
required property int index
|
||||
property real angle: index * root.angleStep - Math.PI / 2
|
||||
|
||||
x: root.width / 2 + root.radius * Math.cos(angle) - width / 2
|
||||
y: root.height / 2 + root.radius * Math.sin(angle) - height / 2
|
||||
|
||||
text: root.dateText.charAt(index)
|
||||
|
||||
font.family: Appearance.font.family.title
|
||||
font.pixelSize: 30
|
||||
font.weight: Font.DemiBold
|
||||
|
||||
color: index < 3 ? root.dayColor : root.monthColor
|
||||
|
||||
rotation: angle * 180 / Math.PI + 90
|
||||
|
||||
color: root.color
|
||||
font {
|
||||
family: Appearance.font.family.title
|
||||
pixelSize: 30
|
||||
weight: Font.DemiBold
|
||||
}
|
||||
|
||||
text: root.dateText.charAt(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user