ASCII weather app for the terminal
Days of Thunder
Other applications have found less complex ways of showing the weather in a terminal, but none is as attractive as Wego.
People love to check out the weather forecast, but some users prefer to avoid the many web-based services, where you first need to search for the forecast amid all the advertising or switch to the desktop and face the weather through a Plasmoid or Conky widget. Users who always have a terminal open will appreciate the attractive Wego option for presenting the weather in a command-line window.
The Wego weather app [1], written in the Go programming language designed by Google, uses ASCII art to display the weather forecast for the next one to five days. In this case, using the terminal does not mean poor visuals or a lack of functionality. In this article, I'll take a closer look at Wego and briefly investigate the alternatives.
Weather Forecast
Wego delivers information on the temperature range, wind speed and direction, visibility, and the likelihood and amount of precipitation (Figure 1) for up to five days in advance. The information is SSL-encrypted for transmission to the local computer.
The requirements for installation are quickly met. If you've not done so already, you need to set up Git and a Go environment and also register on the weather website at forecast.io. You can pick up a free API key from the site that lets Wego retrieve the raw weather data. The terminal you are using must support 256 colors and UTF-8. Most terminals meet these requirements out of the box, although you may have to adapt the settings by right-clicking on the open terminal in the profile. You can experiment with the font type and size until the Wego output is to your liking.
Preparations
First, install Go and Git for your distribution. On Debian and its derivatives, you can do this with the command from the first line of Listing 1. On Fedora, the corresponding command is, for example:
dnf install golang git
Listing 1
Go Environment Setup
01 $ sudo apt-get update && sudo apt-get install golang git 02 $ echo 'export GOPATH="$HOME/wego"' >> ~/.bashrc; source ~/.bashrc 03 $ mkdir ~/wego 04 $ go get github.com/schachmat/wego 05 $ echo 'export PATH="$PATH:$GOPATH/bin"' >> ~/.bashrc; source ~/.bashrc
Next, you need to set up an environment for Go. To integrate a Go environment, you first need to set an environmental variable for Go. The command from the second line of Listing 1 writes the GOPATH
to the .bashrc
file, the shell configuration file.
Now check Wego out of GitHub – that is, download the code to your computer. To do this, create the directory specified in the environmental variable and pick up the code from GitHub (Listing 1, lines 3 and 4). You could start Wego now, by changing to the directory with the executable and typing ./wego
. However, to make the call more convenient, and to be able to call Wego as a user from anywhere in the terminal, you need to set a second environmental variable that adds /bin
to your GOPATH
(Listing 1, line 5).
After you add /bin
, you can launch Wego in a terminal simply by typing wego
. However, you will still not see the weather displayed when you first start – the program needs you to point it to the data source. Instead, you just see two error messages (Listing 2). The first line is simply telling you that the program creates the hidden configuration file, ~/.wegorc
, when first launched. You will need to edit this file now.
Listing 2
Error Messages
$ wego No config file found. Creating /home/User/.wegorc ... No API key specified. Setup instructions are in the README.
API Key
The second line refers to the API key, which you need to get to see the weather (Figure 2). To get the API key, surf to the website on https://developer.forecast.io/register. After you have registered, your free API key will be presented to you. Then, copy the APIKey
to the hidden .wegorc
file in your home directory (Listing 3).
Listing 3
Specify Location
{ "APIKey": "MyAPIkey", "City": "Kansas City", "Numdays": 3, "Imperial": false, "Lang": "en" }
You can specify a location (City
) as well as the number of forecast days (Numdays
) you want to see. If you want to specify values in imperial measures, change the setting for the Imperial
keyword from false
to true
.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Endless OS 6 has Arrived
After more than a year since the last update, the latest release of Endless OS is now available for general usage.
-
Fedora Asahi 40 Remix Available for Macs with Apple Silicon
If you've been anticipating KDE's Plasma 6 for your Apple Silicon-powered Mac, then you're in luck.
-
Red Hat Adds New Deployment Option for Enterprise Linux Platforms
Red Hat has re-imagined enterprise Linux for an AI future with Image Mode.
-
OSJH and LPI Release 2024 Open Source Pros Job Survey Results
See what open source professionals look for in a new role.
-
Proton 9.0-1 Released to Improve Gaming with Steam
The latest release of Proton 9 adds several improvements and fixes an issue that has been problematic for Linux users.
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.