use Dimensions config
This commit is contained in:
parent
dd6d45c4b6
commit
6df0784136
7 changed files with 147 additions and 63 deletions
|
|
@ -1,48 +1,39 @@
|
|||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import "root:styled"
|
||||
import "../../../config/"
|
||||
|
||||
Item {
|
||||
id: clock
|
||||
|
||||
implicitWidth: 200
|
||||
implicitHeight: 30
|
||||
implicitWidth: Dimensions.clock.width
|
||||
implicitHeight: Dimensions.clock.height
|
||||
|
||||
StyledLabel {
|
||||
anchors.fill: parent
|
||||
anchors.fill: text
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: text
|
||||
anchors.centerIn: parent
|
||||
|
||||
font.pixelSize: Dimensions.clock.fontSize
|
||||
|
||||
Process {
|
||||
// give the process object an id so we can talk
|
||||
// about it from the timer
|
||||
id: dateProc
|
||||
|
||||
command: ["date"]
|
||||
running: true
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: text.text = this.text
|
||||
onStreamFinished: text.text = ` ${this.text}`
|
||||
}
|
||||
}
|
||||
|
||||
// use a timer to rerun the process at an interval
|
||||
Timer {
|
||||
// 1000 milliseconds is 1 second
|
||||
interval: 1000
|
||||
|
||||
// start the timer immediately
|
||||
running: true
|
||||
|
||||
// run the timer again when it ends
|
||||
repeat: true
|
||||
|
||||
// when the timer is triggered, set the running property of the
|
||||
// process to true, which reruns it if stopped.
|
||||
onTriggered: dateProc.running = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue