weather.widget 795 B

1234567891011121314151617181920212223
  1. # Parse yr.no weather forecast
  2. scanner {
  3. Exec("wget -O - \"https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=41.9028&lon=12.4964\"") {
  4. #file("/tmp/weather"){
  5. WthrTemp= Json(".properties.timeseries.1.data.instant.details.air_temperature")
  6. WthrCond= Json(".properties.timeseries.1.data.next_12_hours.summary.symbol_code")
  7. }
  8. }
  9. layout {
  10. style = "panel_item"
  11. label {
  12. interval = 600000
  13. #css = "* { font: 0.5cm Sans; font-weight: 700; -GtkWidget-align: 0.5; padding-left: 1mm; padding-right: 1mm; }"
  14. value = Str(WthrTemp.val,1)
  15. }
  16. image {
  17. interval = 600000
  18. css = "* { -GtkWidget-hexpand: true; -GtkWidget-vexpand: true; padding-left: 1mm; padding-right: 1mm;min-width: 0.5cm;min-height: 0.5cm; }"
  19. value = 'icons/weather/'+$WthrCond+'.svg'
  20. }
  21. }