forked from Shinonome/dots-hyprland
vertical bar: add date
This commit is contained in:
@@ -280,6 +280,7 @@ Singleton {
|
|||||||
property JsonObject time: JsonObject {
|
property JsonObject time: JsonObject {
|
||||||
// https://doc.qt.io/qt-6/qtime.html#toString
|
// https://doc.qt.io/qt-6/qtime.html#toString
|
||||||
property string format: "hh:mm"
|
property string format: "hh:mm"
|
||||||
|
property string shortDateFormat: "dd/MM"
|
||||||
property string dateFormat: "ddd, dd/MM"
|
property string dateFormat: "ddd, dd/MM"
|
||||||
property JsonObject pomodoro: JsonObject {
|
property JsonObject pomodoro: JsonObject {
|
||||||
property string alertSound: ""
|
property string alertSound: ""
|
||||||
|
|||||||
@@ -153,6 +153,9 @@ Item { // Bar content region
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: false
|
Layout.fillHeight: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HorizontalBarSeparator {}
|
||||||
|
|
||||||
VerticalMedia {
|
VerticalMedia {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: false
|
Layout.fillHeight: false
|
||||||
@@ -198,11 +201,25 @@ Item { // Bar content region
|
|||||||
Layout.fillHeight: false
|
Layout.fillHeight: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HorizontalBarSeparator {}
|
||||||
|
|
||||||
|
VerticalDateWidget {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: false
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalBarSeparator {
|
||||||
|
visible: UPower.displayDevice.isLaptopBattery
|
||||||
|
}
|
||||||
|
|
||||||
BatteryIndicator {
|
BatteryIndicator {
|
||||||
visible: UPower.displayDevice.isLaptopBattery
|
visible: UPower.displayDevice.isLaptopBattery
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: false
|
Layout.fillHeight: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import qs.modules.common
|
||||||
|
import qs.modules.common.widgets
|
||||||
|
import qs.services
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import "../bar" as Bar
|
||||||
|
|
||||||
|
Item { // Full hitbox
|
||||||
|
id: root
|
||||||
|
|
||||||
|
implicitHeight: content.implicitHeight
|
||||||
|
implicitWidth: Appearance.sizes.verticalBarWidth
|
||||||
|
property var dayOfMonth: DateTime.shortDate.split(/[-\/]/)[0] // What if 🍔murica🦅? good question
|
||||||
|
property var monthOfYear: DateTime.shortDate.split(/[-\/]/)[1]
|
||||||
|
|
||||||
|
Item { // Boundaries for date numbers
|
||||||
|
id: content
|
||||||
|
anchors.centerIn: parent
|
||||||
|
implicitWidth: 24
|
||||||
|
implicitHeight: 30
|
||||||
|
|
||||||
|
Shape {
|
||||||
|
id: diagonalLine
|
||||||
|
property real padding: 4
|
||||||
|
anchors.fill: parent
|
||||||
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
|
||||||
|
ShapePath {
|
||||||
|
strokeWidth: 1.2
|
||||||
|
strokeColor: Appearance.colors.colSubtext
|
||||||
|
fillColor: "transparent"
|
||||||
|
startX: content.width - diagonalLine.padding
|
||||||
|
startY: diagonalLine.padding
|
||||||
|
PathLine {
|
||||||
|
x: diagonalLine.padding
|
||||||
|
y: content.height - diagonalLine.padding
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: dayText
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
font.pixelSize: 13
|
||||||
|
color: Appearance.colors.colOnLayer1
|
||||||
|
text: dayOfMonth
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: monthText
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
font.pixelSize: 13
|
||||||
|
color: Appearance.colors.colOnLayer1
|
||||||
|
text: monthOfYear
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ Singleton {
|
|||||||
precision: SystemClock.Minutes
|
precision: SystemClock.Minutes
|
||||||
}
|
}
|
||||||
property string time: Qt.locale().toString(clock.date, Config.options?.time.format ?? "hh:mm")
|
property string time: Qt.locale().toString(clock.date, Config.options?.time.format ?? "hh:mm")
|
||||||
|
property string shortDate: Qt.locale().toString(clock.date, Config.options?.time.shortDateFormat ?? "dd/MM")
|
||||||
property string date: Qt.locale().toString(clock.date, Config.options?.time.dateFormat ?? "dddd, dd/MM")
|
property string date: Qt.locale().toString(clock.date, Config.options?.time.dateFormat ?? "dddd, dd/MM")
|
||||||
property string collapsedCalendarFormat: Qt.locale().toString(clock.date, "dd MMMM yyyy")
|
property string collapsedCalendarFormat: Qt.locale().toString(clock.date, "dd MMMM yyyy")
|
||||||
property string uptime: "0h, 0m"
|
property string uptime: "0h, 0m"
|
||||||
|
|||||||
Reference in New Issue
Block a user