31 lines
872 B
QML
31 lines
872 B
QML
// modules/ClockWidget.qml - " HH:MM DD Mon" (matches waybar clock format)
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell.Io
|
|
import ".."
|
|
|
|
Pill {
|
|
onClicked: (m) => {
|
|
if (m.button === Qt.LeftButton)
|
|
Exec.run(["kitty", "-e", "calcure", "--class=float", "-T", "calcure"])
|
|
}
|
|
|
|
Text {
|
|
text: " " + Qt.formatDateTime(clock.now, "HH:mm") +
|
|
" " + Qt.formatDateTime(clock.now, "d MMM")
|
|
font { family: Theme.fontSans; pixelSize: Theme.fontSize }
|
|
color: Theme.foreground
|
|
}
|
|
|
|
// Update every 10 s (no need for per-second ticks)
|
|
QtObject {
|
|
id: clock
|
|
property var now: new Date()
|
|
property var timer: Timer {
|
|
interval: 10000; running: true; repeat: true
|
|
triggeredOnStart: true
|
|
onTriggered: clock.now = new Date()
|
|
}
|
|
}
|
|
}
|