43 lines
1 KiB
QML
43 lines
1 KiB
QML
import QtQuick
|
|
import Quickshell.Io
|
|
import "." as M
|
|
|
|
M.BarSection {
|
|
id: root
|
|
spacing: M.Theme.moduleSpacing
|
|
tooltip: root.weatherTooltip
|
|
|
|
property string weatherTooltip: ""
|
|
|
|
Process {
|
|
id: proc
|
|
running: true
|
|
command: ["wttrbar", "--nerd"]
|
|
stdout: StdioCollector {
|
|
onStreamFinished: {
|
|
try {
|
|
const data = JSON.parse(text);
|
|
label.text = data.text ?? "";
|
|
root.weatherTooltip = data.tooltip ?? "";
|
|
} catch (e) {
|
|
label.text = "";
|
|
root.weatherTooltip = "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Timer {
|
|
interval: 3600000
|
|
running: true
|
|
repeat: true
|
|
onTriggered: proc.running = true
|
|
}
|
|
|
|
Text {
|
|
id: label
|
|
color: M.Theme.base05
|
|
font.pixelSize: M.Theme.fontSize
|
|
font.family: M.Theme.iconFontFamily
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
}
|