36 lines
783 B
QML
36 lines
783 B
QML
pragma Singleton
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
Singleton {
|
|
|
|
readonly property string user: userProcess.user
|
|
readonly property string uptime: fileUptime.uptime
|
|
|
|
Timer {
|
|
running: true
|
|
repeat: true
|
|
interval: 15000
|
|
triggeredOnStart: true
|
|
onTriggered: fileUptime.reload()
|
|
}
|
|
|
|
FileView {
|
|
id: fileUptime
|
|
property string uptime: ""
|
|
path: "/proc/uptime"
|
|
onLoaded: uptime = Time.formatSeconds(parseInt(text().split(" ")[0] ?? 0));
|
|
}
|
|
|
|
Process {
|
|
id: userProcess
|
|
property string user: ""
|
|
running: true
|
|
command: ["whoami"]
|
|
stdout: StdioCollector {
|
|
onStreamFinished: userProcess.user = this.text.trim()
|
|
}
|
|
}
|
|
}
|