35 lines
928 B
QML
35 lines
928 B
QML
// modules/WeatherWidget.qml - wttr.in one-liner, refreshed hourly
|
|
import QtQuick
|
|
import Quickshell.Io
|
|
import ".."
|
|
|
|
Pill {
|
|
id: root
|
|
property string weatherText: "..."
|
|
|
|
Text {
|
|
text: weatherText
|
|
font { family: Theme.fontSans; pixelSize: Theme.fontSize }
|
|
color: Theme.foreground
|
|
}
|
|
|
|
// ── Fetch via curl ────────────────────────────────────────
|
|
Process {
|
|
id: curl
|
|
command: ["curl", "-s", "--max-time", "8", "https://wttr.in/?format=1"]
|
|
running: false
|
|
stdout: SplitParser {
|
|
onRead: (line) => root.weatherText = line.trim()
|
|
}
|
|
onExited: curl.running = false
|
|
}
|
|
|
|
Timer {
|
|
interval: 3600000 // 1 hour
|
|
running: true
|
|
repeat: true
|
|
triggeredOnStart: true
|
|
onTriggered: curl.running = true
|
|
}
|
|
}
|