me like nix
1pragma Singleton
2
3import QtQuick
4import Quickshell
5import Quickshell.Io
6
7QtObject {
8 readonly property string weather: _weather
9 readonly property string icon: _icon
10 readonly property string temp: _temp
11
12 property string _weather: ""
13 property string _icon: ""
14 property string _temp: ""
15
16 property var _proc: Process {
17 command: ["sh", "-c", "curl -sf 'wttr.in/?format=%c|%t&m' | tr -d '+'"]
18 stdout: SplitParser {
19 onRead: data => {
20 if (!data) return
21 var raw = data.trim()
22 var parts = raw.split("|")
23 if (parts.length >= 2) {
24 _icon = parts[0].trim()
25 _temp = parts[1].trim()
26 _weather = _icon + " " + _temp
27 } else {
28 _weather = raw
29 }
30 }
31 }
32 Component.onCompleted: running = true
33 }
34
35 property var _timer: Timer {
36 interval: 900000
37 running: true
38 repeat: true
39 onTriggered: _proc.running = true
40 }
41}