76 lines
2.2 KiB
QML
76 lines
2.2 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import "../../../colors"
|
|
|
|
Rectangle { //workspace
|
|
width: timeDisplay.width + 8 + dateDisplay.width + 16
|
|
height: timeDisplay.height + 16
|
|
radius: 4
|
|
color: Colors.primaryContainer
|
|
border.color: Colors.primaryContainer_fg
|
|
border.width: 2
|
|
MouseArea {
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
anchors.fill: parent
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
|
|
|
Row {
|
|
id: row
|
|
spacing: 8
|
|
anchors.centerIn: parent
|
|
|
|
Text {
|
|
id: dateDisplay
|
|
property string currentDate: ""
|
|
|
|
text: currentDate
|
|
color: Colors.primary
|
|
font.pixelSize: 18
|
|
font.family: "Inter, sans-serif"
|
|
|
|
Timer {
|
|
id: dateTimer
|
|
interval: 60000
|
|
running: false
|
|
repeat: true
|
|
triggeredOnStart: true
|
|
onTriggered: {
|
|
var now = new Date()
|
|
dateDisplay.currentDate = Qt.formatDate(now, "ddd, dd.MM.yyyy -")
|
|
}
|
|
}
|
|
}
|
|
|
|
Text {
|
|
id: timeDisplay
|
|
property string currentTime: ""
|
|
|
|
text: currentTime
|
|
color: Colors.primary
|
|
font.pixelSize: 18
|
|
font.family: "Inter, sans-serif"
|
|
|
|
Component.onCompleted: {
|
|
var now = new Date()
|
|
currentTime = Qt.formatTime(now, "hh:mm:ss")
|
|
}
|
|
|
|
Timer {
|
|
interval: 1000
|
|
running: true
|
|
repeat: true
|
|
onTriggered: {
|
|
var now = new Date()
|
|
timeDisplay.currentTime = Qt.formatTime(now, "hh:mm:ss")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
onClicked: {
|
|
dateDisplay.currentDate = "";
|
|
dateTimer.running = !dateTimer.running;
|
|
}
|
|
}
|
|
} |