Update weather

This commit is contained in:
ferrreo 2023-08-20 19:33:37 +01:00
parent 8dce69ae4f
commit 9fa4194b43
2 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,9 @@
pika-hyprland-settings (1.1.2-99pika1) lunar; urgency=medium
* Fix weather
-- ferrreo <harderthanfire@gmail.com> Sat, 01 Oct 2022 14:50:00 +0300
pika-hyprland-settings (1.1.1-99pika1) lunar; urgency=medium
* Add missing fonts

View File

@ -24,11 +24,14 @@ export const Weather = () => Widget.Box({
],
connections: [[900000, async box => {
try {
// timeout here is to delay enough on boot that network has time to connect - this is a hack but for something that updates so rarely it's fine
setTimeout(() => {
let weather = exec(`curl https://wttr.in/${city}?format=j1`);
weather = JSON.parse(weather);
const weatherCode = weather.current_condition[0].weatherCode;
box.children[0].label = WEATHER_SYMBOL[WWO_CODE[weatherCode]];
box.children[1].label = weather.current_condition[0].temp_C + "°C";
}, 5000);
} catch (err) {
console.log(err);
}