Files
Quickbar/ClockWidget.qml
2025-10-07 23:15:53 -03:00

60 lines
1.3 KiB
QML

import QtQuick
import Quickshell.Widgets
import Quickshell.Io
import qs.Services
import qs.Common
Item {
property var monitor: ""
MarginWrapperManager {
rightMargin: Theme.gaps
leftMargin: Theme.gaps
}
Rectangle {
id: clock
color: Theme.backgroudColor
implicitWidth: clockText.implicitWidth * 1.6
implicitHeight: Theme.heightGaps
radius: 25
property string calendar: ""
Text {
id: clockText
anchors.centerIn: parent
text: Time.time
font.bold: true
font.pixelSize: Theme.pixelSize
font.family: Theme.fontFamily
color: Theme.textColor
}
Process {
id: cal
running: true
command: ["cal", "-S3"]
stdout: StdioCollector {
onStreamFinished: {
clock.calendar = this.text;
}
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
cal.running = true;
PopUpHover.start(clock, "time");
}
onExited: {
PopUpHover.exit();
}
}
}
}