Weather.qml
1 pragma Singleton 2 3 import "root:/utils" 4 import Quickshell 5 import Quickshell.Io 6 7 Singleton { 8 id: root 9 10 property string icon 11 property string description 12 property real temperature 13 14 function reload(): void { 15 wttrProc.running = true; 16 } 17 18 Process { 19 id: wttrProc 20 21 running: true 22 command: ["fish", "-c", `curl "https://wttr.in/$(curl ipinfo.io | jq -r '.city' | string replace -a ' ' '%20')?format=j1" | jq -c '.current_condition[0] | {code: .weatherCode, desc: .weatherDesc[0].value, temp: .temp_C}'`] 23 stdout: SplitParser { 24 onRead: data => { 25 const json = JSON.parse(data); 26 root.icon = Icons.getWeatherIcon(json.code); 27 root.description = json.desc; 28 root.temperature = parseFloat(json.temp); 29 } 30 } 31 } 32 }