I have been searching for a nice weather desktop app but found it either too heavy, requiring API key, or the scripts are outdated. The latter was more in my line to be adding to Yad buttons. In my search, find something much better. Two bash commands that take a screenshot directly of a weather website. Instead of text extract, takes a screenshot without opening a web browser. Then crop the screenshot of a selected area. (It requires cutycapt and ImageMagick).
Here are screenshots of how the weather app will look in FVWM and XFCE (any DE or WM). This is the test script with the crop, append, and text addon that needs improvement, hopefully, someone could help. The script works but does not look “professional”.
When ready, I will upload a zip file with full content.
weatherIMG.sh
#! /bin/bash
## By Rasat 5 April 2023
## Weather website image and cropping.
## Check connection
ping -q -c1 timeanddate.com &>/dev/null && echo online || test="offline"
if [ $test = offline ]; then
yad --width=300 --height=30 --title="Alert" --text-align=center \
--text="<b>You are offline, check timeanddate.com or your device connection.</b>" --button=Close:0
exit
fi
cd ~/.fvwm/extraEXT/MODULES/WeatherB/
echo "loading..." > load.tmp
## Location
PLACE=$(awk '{ print $1 }' location/country-city.txt | sed 's/|/,/g;s/.$//' location/country-city.txt)
echo $PLACE > location.txt
## Link
URL=$(sed 's/,/\//' location.txt)
## Screenshot
cutycapt --url=timeanddate.com/weather/$URL --out=cache/timeDateWEB.png # 803x2990
## Crop, (width x height + left + top), resize and button icon
convert cache/timeDateWEB.png -crop 392x335+0+840 cache/timeDateCRP.png
convert cache/timeDateWEB.png -crop 130x200+10+345 -resize 124x image/timeDateCRP-tmb.png # 124x191
convert cache/timeDateWEB.png -crop 76x76+27+668 image/timeDateICON.png
## Append vertical (-append) and horisontal (+append) and add location lable.
convert image/timeDateCRP-tmb.png image/blue124x135.png -pointsize 13 \
-annotate +10+18 $PLACE -append cache/blueNOW.png # image/blue124x335.png
convert cache/timeDateCRP.png cache/blueNOW.png +append image/timeDateNOW.png
yad --title="TDWeather" --image=image/timeDateNOW.png --fontname="DejaVu Sans Mono Book 10" \
--button='Setting:bash -c "./location/countryCity.sh"' \
--button='Restart:bash -c "killall -SIGUSR1 fvwm3"' \
--button=gtk-close:0 --undecorated
Great, also on MX Linux a few were asking. Been a long winter, want to know when the summer is coming.
Needs a major improvement, from MX comments, takes a long time to connect the website and get the screenshot. Needs a background load that also updates the icon and thumbnail on the desktop. I am now checking on how to run bash script as a daemon in the background.
Oh, I wasn t aware of that since it s been years that I haven t looked at their forum, thx for sharing, we might find ideas here & there with those threads.
I see that timeanddata uses the ICAO code of nearby airfields. In my case I have two (7602423; 2878037). However, these are so far away from me that I cannot use them. I have already noticed this in the conky again and again, because the data does not match the location.
Works fine as wallpaper, actually quite cool. I did a test on one of my favorite wallpapers. First with one crop image and another by splitting the image into four thumbnails.
NOTE: It took time to find the ImageMagic options, here I included also the details in the headers.
Does not work at all … /home/sector11/weatherwall remains empty.
HELP Please… Installed:
$ ser imagemagick cutycapt
i cutycapt - utility to capture WebKit's rendering of a web page
i imagemagick - image manipulation programs -- binaries
i A imagemagick-6-common - image manipulation programs -- infrastructure
i imagemagick-6-doc - document files of ImageMagick
i A imagemagick-6.q16 - image manipulation programs -- quantum depth Q16
08 Apr 23 @ 12:12:20 ~
$
Code still a bit messy - still playing with it.
I call it: fwall (Feh + WALLpaper)
#!/bin/sh
<< weather
https://forum.archlabslinux.com/t/real-time-weather-app/7251/1
timeanddate.com - one on my 'goto sites'
Thanks: rasat & unklar
more reading, more tweaking ahead.
https://www.timeanddate.com/weather/argentina/buenos-aires
for now:
terminal $ fwall
[alt]+[F] [fwall]
OB Menu? in time
weather
cd /home/sector11/weatherwall
rm *.png
exec 2>/dev/null
cutycapt --url=https://www.timeanddate.com/weather/argentina/buenos-aires --out=timeDate.png
convert timeDate.png -crop 777x400+0+380 CABA.png
feh CABA.png &
Remove command “>”. And the default cutycapt screenshot is 803x3047. To screenshot the full width of timeanddate.com website (1000px) add min-width=1050.