Weather Applet for Cinnamon and Xfce

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
christosangelopoulos
Level 3
Level 3
Posts: 152
Joined: Fri Nov 13, 2020 10:19 pm

Weather Applet for Cinnamon and Xfce

Post by christosangelopoulos »

https://gitlab.com/christosangel/weathe ... /tree/main

This is another bash script that serves as a weather applet for Linux Mint OS.
It will detect the Desktop Environment (Cinnamon or Xfce), and will show the weather in the panel.

Image

It will work with the CommandRunner applet (in the case of Cinnamon DE) or Generic Monitor applet(XFCE).
Hovering over the panel applet will show a tooltip with the following info:
  • Last update time
  • Current conditions
  • Temperature
  • Wind direction and speed
  • View range
  • Precipitation (rainfall) in mm
Image

Clicking on the applet will also give weather forecast for the 2 following days.

Image

DEPENDENCIES
In order to work, this script depends on the powerful command cURL.
The source of the data that are presented:
http://wttr.in/
https://github.com/chubin/wttr.in
The presentation of the forecast is done with the dialog command yad.
To install these dependencies, open a terminal and type:

Code: Select all

sudo apt install curl yad

INSTRUCTIONS
  • Change Directory to forecast_xfce_cinnamon

Code: Select all

cd forecast_xfce_cinnamon

IMPORTANT: Enter your current location
In order for the script to function , you must insert your location in line 7 of the forecast_xfce_cinnamon.sh script.
you can do it with this command in the terminal:

Code: Select all

sed -i '7i curl wttr.in/city'sname?FQT' Forecast.sh
For example, if the location was Athens,Greece the command would be :

Code: Select all

sed -i '7i curl wttr.in/Athens,Greece?FQT' Forecast.sh
You can find more info on setting the location, and on how this command works, by executing this command in the terminal:

Code: Select all

curl wttr.in/:help
  • Make Forecast.sh executable with the following command in terminal:

Code: Select all

chmod +x Forecast.sh 
For Cinnamon DE:


Make sure you download the CommandRunner Applet in cinnamon panel:

  • Right click on the panel you want to present the network monitor
  • Select Applets
  • Select Download tab, select CommandRunner and download it
  • Back on the Manage tab, press the CommandRunner Configure button.
  • In the Command field, enter :
    /home/user'sname/path-to-directory/forecast_xfce_cinnamon/Forecast.sh
  • In the Run Interval field, put: 1800 seconds (refreshing every 30 minutes in my opinion is good enough)
  • Hit Apply
  • You are good to go.

For Xfce DE:

  • Make sure you add the Generic Monitor Applet in the panel:
  • Right click on the panel you want to add the network monitor
  • Select Panel
  • Select +Add New Items tab, select Generic Monitor and press Add.
  • Right-click on the Generic Monitor Applet that has appeared on the panel, select Properties.
  • In the Command field, enter : /home/user'sname/path-to-directory/forecast_xfce_cinnamon/Forecast.sh
  • Untick the Label box
  • In the Period(s) field, put: 1800 seconds (refreshing every 30 minutes in my opinion is good enough)
  • Close the Properties tab
  • You are good to go.
I would love to have your feedback.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Locked

Return to “Scripts & Bash”