Gtkdialog: Simple weather app using wttr.in
Posted: Fri Apr 16, 2021 9:53 pm
Save as eg. weather.sh:
Code: Select all
#!/bin/sh
getWeatherForecast() {
locale=$(locale -k LC_IDENTIFICATION | grep "category")
wget -O /tmp/weather.png "wttr.in/$1_lang=${locale:10:2}.png"
}
export -f getWeatherForecast
export MAIN_DIALOG='
<window title="Puppy Weather" icon-name="dialog-information" default_height="518" default_width="1000">
<vbox>
<hbox>
<entry>
<default>Your City</default>
<variable>ENTRY</variable>
</entry>
<button ok>
<action>getWeatherForecast "$ENTRY"</action>
<action function="Refresh">pixmap1</action>
</button>
</hbox>
<pixmap>
<variable>pixmap1</variable>
<input file>/tmp/weather.png</input>
</pixmap>
</vbox>
</window>
'
gtkdialog --program=MAIN_DIALOG