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
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.
-
Plasma Desktop Will Soon Ask for Donations
The next iteration of Plasma has reached the soft feature freeze for the 6.2 version and includes a feature that could be divisive.
-
Linux Market Share Hits New High
For the first time, the Linux market share has reached a new high for desktops, and the trend looks like it will continue.
-
LibreOffice 24.8 Delivers New Features
LibreOffice is often considered the de facto standard office suite for the Linux operating system.
-
Deepin 23 Offers Wayland Support and New AI Tool
Deepin has been considered one of the most beautiful desktop operating systems for a long time and the arrival of version 23 has bolstered that reputation.
-
CachyOS Adds Support for System76's COSMIC Desktop
The August 2024 release of CachyOS includes support for the COSMIC desktop as well as some important bits for video.
-
Linux Foundation Adopts OMI to Foster Ethical LLMs
The Open Model Initiative hopes to create community LLMs that rival proprietary models but avoid restrictive licensing that limits usage.
-
Ubuntu 24.10 to Include the Latest Linux Kernel
Ubuntu users have grown accustomed to their favorite distribution shipping with a kernel that's not quite as up-to-date as other distros but that changes with 24.10.