nova-shell/modules/Weather.qml
2026-04-12 17:00:13 +02:00

41 lines
968 B
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"].concat(M.Modules.weatherArgs)
stdout: StdioCollector {
onStreamFinished: {
try {
const data = JSON.parse(text);
label.icon = data.text ?? "";
root.weatherTooltip = data.tooltip ?? "";
} catch (e) {
label.icon = "";
root.weatherTooltip = "";
}
}
}
}
Timer {
interval: 3600000
running: true
repeat: true
onTriggered: proc.running = true
}
M.BarIcon {
id: label
color: M.Theme.base08
anchors.verticalCenter: parent.verticalCenter
}
}