add clock

This commit is contained in:
Sakooooo 2025-01-10 16:00:43 +04:00
parent d1e97cad62
commit c32e27b471
Signed by: sako
GPG key ID: FE52FD65B76E4751
3 changed files with 51 additions and 15 deletions

View file

@ -0,0 +1,41 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Quickshell
ListView {
id: root
height: 110
width: 60
anchors.centerIn: parent
SystemClock {
id: clock
precision: SystemClock.Minutes
}
Item {
width: parent.width
height: parent.height
anchors.centerIn: parent
Rectangle {
width: 50
height: 60
anchors.centerIn: parent
Text {
Layout.alignment: Qt.AlignHCenter
anchors.centerIn: parent
text: {
const hours = clock.hours.toString().padStart(2, '0')
const minutes = clock.minutes.toString().padStart(2, '0')
return `${hours}\n${minutes}`
}
font.pointSize: 20
color: "black"
}
}
}
}

View file

@ -15,7 +15,7 @@ ListView {
model: workspaceArray
anchors.top: parent.top
anchors.centerIn: parent
height: 500
height: 110
width: 60
spacing: 2
delegate: Item {

View file

@ -56,27 +56,22 @@ ShellRoot {
// Center
RowLayout {
anchors.centerIn: parent
/* Text { */
/* color: "#FFFFFF" */
/* // now just time instead of root.time */
/* text: time */
/* } */
Text {
color: "#FFFFFF"
// now just time instead of root.time
text: time
}
}
// right
RowLayout {
/* anchors.right: parent.right */
/* anchors.top: parent.top */
anchors.bottom: parent.bottom
spacing: 5
Battery { }
Text {
color: "#FFFFFF"
text: "Right"
}
Battery { }
Time { }
}
}
@ -84,7 +79,7 @@ ShellRoot {
Process {
id: dateProc
command: ["date"]
command: ["date", "+%I:%M%p %A, %b %e, %Y"]
running: true
stdout: SplitParser {