XFCE|Add text plugin with weather and more…


XFCE|Add text plugin with weather and more…

Lets add some weather information to our XFCE panel/status bar and have a result like this…

bar

First we have to install the Generic Monitor plugin/widget to our XFCE installation. To do so, just give the following command in a terminal: sudo apt install xfce4-genmon-plugin

Edit the panel preferences and add a General Monitor widget…

pref

For the weather, we will need another application, that will make things very easy. It’s called ANSIWEATHER and you can install it with: sudo apt-get install ansiweather

Create a script and insert the following:

#!/bin/bash
IIP=$(hostname -I | cut -f1 -d" ")
EIP=$(curl ipinfo.io/ip)
#echo "$IIP | $EIP"
WEATHER=$(ansiweather -l London -a false -s true -i false -u metric -p false)
FORECAST=$(ansiweather -l London -f 5 -a false)
FORECAST=$(echo "$FORECAST" | sed 's/-/\n/g' | sed 's/:/\n/g')
WEATHER=$(echo $WEATHER | sed 's/Weather in London:/🌡/g')
WEATHER=$(echo $WEATHER | sed 's/- Wind:/| 💨/g')
WEATHER=$(echo $WEATHER | sed 's/- Humidity:/| 💧/g')
echo "<txt>$WEATHER | $IIP | $EIP </txt><tool>$FORECAST</tool>"
exit 0

Save it and make it executable. You can add more stuff in this script, for example disk capacity, cpu load, temperatures etc. You can read more about the Generic Monitor widget and its usage in this web page.

Right click the widget on the panel and edit its properties…

prop

Insert the name of the script you just created, choose your preferred font and change the interval to something properly for your likings. You can deselect the Label or edit it to something more meaningful. Press Save and you are ready.

Add a comment

Previous Next