A dashboard for your terminal
Dashboards usually provide a quick rundown of information at a glance. Shashank Sharma reveals how you can set one up for your terminal.
What does a Dodge Charger have in common with business server distributions such as Zentyal and Clearos? Having recently done a Roundup featuring the latter two (LXF256) and also driven the former while on vacation in the USA, the author can confidently report that they all feature a rather interactive and impressive-looking dashboard. In computing terms, a dashboard is a user interface that provides an organised layout for a variety of information for quick assimilation. With WTF, you can quickly configure a multi-paned dashboard for your terminal.
Distributed under the Mozilla Public Licence and written in Go, the WTF project prominently features a list of all its many contributors on its Github page. It also has a rather detailed code of conduct , adopted from the Contributor Covenant, which only helps highlight the maturity behind the project. The project supports many different modes of installation, depending on user preference. In addition to installing the binary, which we’ll discuss in a moment, you can also install it via Homebrew and Scarf. It’s also possible to compile it from source, but that’s a slightly more involved process, though not cumbersome. Since
WTF is a standalone binary, the easiest method is to download latest binary release from Github:
$ cd Downloads/projects
$ wget -c https://github.com/wtfutil/wtf/releases/ download/v0.22.0/wtf_0.22.0_linux_amd64.tar.gz
$ tar xf wtf_0.22.0_linux_amd64.tar.gz
$ cd wtf_0.22.0_linux_amd64.tar.gz
$ sudo cp wtfutil /usr/local/bin
$ sudo chmod u+x /usr/local/bin/wtfutil
Here, we’ve downloaded the compressed tarball, extracted files from it, moved it to the /usr/local/bin
directory and then made the file executable. You can now run WTF with the wtfutil command.
Irrespective of how you choose to install WTF, it’ll be mighty helpful if you also clone the Git repository locally with the git clone https://github.com/wtfutil/wtf.git
command. We are primarily interested in the sample configs and the modules directory. The former has screenshots and several sample configuration files, to help you better gauge the possibilities of WTF. You will also find a list of all the supported modules within the
modules directory, which should help you decide how to flesh out WTF, as the default is rather vanilla.
A typical desktop user works with a number of different applications at any given time. This usually means switching between different applications every now and then to check for updates. This is where a dashboard such as WTF really shines. You can configure it to display upcoming events in Google Calendar, the status of downloads in Transmission, battery statistics, your favourite subreddit, feeds from Twitter, the output from a command and so on. These different functionalities are provided with the use of Modules, which the project defines as discrete units that extract data from some source and presents it to users within the interface.
When you run WTF for the first time with the wtfutil
command, it displays its configuration file ~/.config/ wtf/config.yml in a pane on the left. The rest of the interface is littered with clocks, battery status and uptime information. There’s also a rudimentary feed reader, which by default displays entries from the project’s blog. Each of these separate panes within the interface is referred to as a widget, and you can also tweak the height and width of the rows and columns that make up the different widgets.
For each module you want to enable, you must also provide its position within the interface and dimensions:
prettyweather: enabled: true city: “California” position: top: 0 left: 0 height: 1 width: 1 refreshinterval: 300 unit: “m” view: 0 language: “en”
The different settings are self-explanatory, except for the position, which we discuss in detail in the box on the opposite page. You can similarly add a widget to display the status of torrents in Transmission by adding the following code block to ~/.config/wtf/config.yml:
transmission: enabled: true username: linuxlala password: xindinx01 position: top: 0 left: 3 height: 1 width: 1 refreshinterval: 1
Its important that you spend some time with the default config file, as well as the others in the _sample_ config directory. When adding new modules into the config file, you must strictly adhere to the space and tab convention as used in the file. Otherwise, WTF points out the exact line which is not in the expected conformity and exits with an error:
ERROR Could not load ‘config.yml’.
This could mean one of two things:
1. Your config.yml file is missing. Check in ~/.config/ wtf/ to see if config.yml is there.
2. Your config.yml file has a syntax error. Try running it through http://www.yamllint.com to check for errors.
Error: yaml: line 101: did not find expected key
This is why you must refer to the documentation on the project’s homepage at https://wtfutil.com that discusses all the available modules, as well as the different settings you must provide for each to get them working. At the very least, this will give you an idea of how to define the different settings, the options that are available for use with different modules.
Although the documentation is helpful, it doesn’t always provide all the pertinent details to enable novices to work with the different modules. For instance, you must have transmission-daemon running on your machine, and enable user login before you can the Transmission module to keep tabs on the status of your downloads.
Interactive widgets
One of the most interesting settings in WTF is shortcuts= true . Some of the widgets in WTF, such as todo, transmission, hackernews, feedreader and so on are user interactive. Unlike other widgets such as prettyweather, status and battery, these interactive widgets enable you to scroll, edit, update and otherwise control the information provided. For instance, the Transmission widget lets you start/pause a torrent, or delete it altogether. Similarly, the Todo widget can be used to add a new task to the todo list, mark completed tasks, move the tasks up or down in priority and so on.
If the shortcuts option is set to true , the interactive widgets in your WTF interface are each assigned a unique numerical identifier. You can then press this number to select the relevant widget. Press / for a list of possible actions you can take to interact with the information provided within the widget. The currently selected interactive widget is highlighted with a differently coloured border for easy identification.
There are some command-line warriors who claim to achieve the same degree of efficiency with Screen and
Tmux, but WTF requires almost no head-scratching at all to install and tweak to your liking. The low barrier to entry, coupled with the possibility of the project being straightforward enough to help you learn the basics of the Go programming language, are reasons enough to give it a fair shake.