clock formatting
This commit is contained in:
parent
f6fa998e33
commit
98f1aea673
3 changed files with 21 additions and 24 deletions
|
|
@ -19,17 +19,19 @@ Singleton {
|
|||
property int border: 2
|
||||
property int height: 50
|
||||
property int verticalMargins: 4
|
||||
property int horizontalMargins: 6
|
||||
property int horizontalMargins: 8
|
||||
property int verticalPadding: 2
|
||||
property int horizontalPadding: 6
|
||||
property int horizontalPadding: 8
|
||||
}
|
||||
|
||||
component Clock: QtObject {
|
||||
id: clock
|
||||
|
||||
property int fontSize: 14
|
||||
property int width: 230
|
||||
property int width: 130
|
||||
property int height: 30
|
||||
property int horizontalPadding: 8
|
||||
property int verticalPadding: 6
|
||||
}
|
||||
|
||||
component Workspace: QtObject {
|
||||
|
|
|
|||
|
|
@ -64,14 +64,12 @@ Scope {
|
|||
anchors.bottomMargin: Dimensions.bar.verticalPadding
|
||||
|
||||
spacing: Dimensions.bar.spacing
|
||||
|
||||
Clock {}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: rightbar
|
||||
|
||||
anchors.right: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
anchors.rightMargin: Dimensions.bar.horizontalPadding
|
||||
|
|
@ -79,6 +77,8 @@ Scope {
|
|||
anchors.bottomMargin: Dimensions.bar.verticalPadding
|
||||
|
||||
spacing: Dimensions.bar.spacing
|
||||
|
||||
Clock {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +1,35 @@
|
|||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import "root:styled"
|
||||
import "../../../styled/"
|
||||
import "../../../config/"
|
||||
|
||||
Item {
|
||||
id: clock
|
||||
id: root
|
||||
|
||||
implicitWidth: Dimensions.clock.width
|
||||
implicitHeight: Dimensions.clock.height
|
||||
|
||||
StyledLabel {
|
||||
anchors.fill: text
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: text
|
||||
anchors.centerIn: parent
|
||||
topPadding: Dimensions.clock.verticalPadding
|
||||
bottomPadding: Dimensions.clock.verticalPadding
|
||||
leftPadding: Dimensions.clock.horizontalPadding
|
||||
rightPadding: Dimensions.clock.horizontalPadding
|
||||
|
||||
font.pixelSize: Dimensions.clock.fontSize
|
||||
|
||||
Process {
|
||||
id: dateProc
|
||||
text: ` ${Qt.formatDateTime(clock.date, "hh:mm:ss AP")}`
|
||||
|
||||
command: ["date"]
|
||||
running: true
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: text.text = ` ${this.text}`
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: dateProc.running = true
|
||||
SystemClock {
|
||||
id: clock
|
||||
precision: SystemClock.Seconds
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue