nova-shell/modules/Weather.qml
2026-04-12 01:00:05 +02:00

43 lines
1,008 B
QML

import QtQuick
import Quickshell.Io
import "." as M
M.BarSection {
id: root
spacing: 4
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
}
}