Update weather
This commit is contained in:
parent
8dce69ae4f
commit
9fa4194b43
@ -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
|
pika-hyprland-settings (1.1.1-99pika1) lunar; urgency=medium
|
||||||
|
|
||||||
* Add missing fonts
|
* Add missing fonts
|
||||||
|
@ -24,11 +24,14 @@ export const Weather = () => Widget.Box({
|
|||||||
],
|
],
|
||||||
connections: [[900000, async box => {
|
connections: [[900000, async box => {
|
||||||
try {
|
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`);
|
let weather = exec(`curl https://wttr.in/${city}?format=j1`);
|
||||||
weather = JSON.parse(weather);
|
weather = JSON.parse(weather);
|
||||||
const weatherCode = weather.current_condition[0].weatherCode;
|
const weatherCode = weather.current_condition[0].weatherCode;
|
||||||
box.children[0].label = WEATHER_SYMBOL[WWO_CODE[weatherCode]];
|
box.children[0].label = WEATHER_SYMBOL[WWO_CODE[weatherCode]];
|
||||||
box.children[1].label = weather.current_condition[0].temp_C + "°C";
|
box.children[1].label = weather.current_condition[0].temp_C + "°C";
|
||||||
|
}, 5000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user