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
-
Linux Kernel Reducing Long-Term Support
LTS support for the Linux kernel is about to undergo some serious changes that will have a considerable impact on the future.
-
Fedora 39 Beta is Now Available for Testing
For fans and users of Fedora Linux, the first beta of release 39 is now available, which is a minor upgrade but does include GNOME 45.
-
Fedora Linux 40 to Drop X11 for KDE Plasma
When Fedora 40 arrives in 2024, there will be a few big changes coming, especially for the KDE Plasma option.
-
Real-Time Ubuntu Available in AWS Marketplace
Anyone looking for a Linux distribution for real-time processing could do a whole lot worse than Real-Time Ubuntu.
-
KSMBD Finally Reaches a Stable State
For those who've been looking forward to the first release of KSMBD, after two years it's no longer considered experimental.
-
Nitrux 3.0.0 Has Been Released
The latest version of Nitrux brings plenty of innovation and fresh apps to the table.
-
Linux From Scratch 12.0 Now Available
If you're looking to roll your own Linux distribution, the latest version of Linux From Scratch is now available with plenty of updates.
-
Linux Kernel 6.5 Has Been Released
The newest Linux kernel, version 6.5, now includes initial support for two very exciting features.
-
UbuntuDDE 23.04 Now Available
A new version of the UbuntuDDE remix has finally arrived with all the updates from the Deepin desktop and everything that comes with the Ubuntu 23.04 base.
-
Star Labs Reveals a New Surface-Like Linux Tablet
If you've ever wanted a tablet that rivals the MS Surface, you're in luck as Star Labs has created such a device.