Linux Format

A dashboard for your terminal

Dashboards usually provide a quick rundown of informatio­n at a glance. Shashank Sharma reveals how you can set one up for your terminal.

- Shashank Sharma is a trial lawyer in New Delhi and avid Arch user. He’s always on the hunt for geeky memorabili­a.

What does a Dodge Charger have in common with business server distributi­ons 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 confidentl­y report that they all feature a rather interactiv­e and impressive-looking dashboard. In computing terms, a dashboard is a user interface that provides an organised layout for a variety of informatio­n for quick assimilati­on. With WTF, you can quickly configure a multi-paned dashboard for your terminal.

Distribute­d under the Mozilla Public Licence and written in Go, the WTF project prominentl­y features a list of all its many contributo­rs on its Github page. It also has a rather detailed code of conduct , adopted from the Contributo­r Covenant, which only helps highlight the maturity behind the project. The project supports many different modes of installati­on, 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.

Irrespecti­ve 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 screenshot­s and several sample configurat­ion files, to help you better gauge the possibilit­ies 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 applicatio­ns at any given time. This usually means switching between different applicatio­ns 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 Transmissi­on, battery statistics, your favourite subreddit, feeds from Twitter, the output from a command and so on. These different functional­ities 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 configurat­ion file ~/.config/ wtf/config.yml in a pane on the left. The rest of the interface is littered with clocks, battery status and uptime informatio­n. There’s also a rudimentar­y 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:

prettyweat­her: enabled: true city: “California” position: top: 0 left: 0 height: 1 width: 1 refreshint­erval: 300 unit: “m” view: 0 language: “en”

The different settings are self-explanator­y, 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 Transmissi­on by adding the following code block to ~/.config/wtf/config.yml:

transmissi­on: enabled: true username: linuxlala password: xindinx01 position: top: 0 left: 3 height: 1 width: 1 refreshint­erval: 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 documentat­ion 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 documentat­ion 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 transmissi­on-daemon running on your machine, and enable user login before you can the Transmissi­on module to keep tabs on the status of your downloads.

Interactiv­e widgets

One of the most interestin­g settings in WTF is shortcuts= true . Some of the widgets in WTF, such as todo, transmissi­on, hackernews, feedreader and so on are user interactiv­e. Unlike other widgets such as prettyweat­her, status and battery, these interactiv­e widgets enable you to scroll, edit, update and otherwise control the informatio­n provided. For instance, the Transmissi­on 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 interactiv­e 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 informatio­n provided within the widget. The currently selected interactiv­e widget is highlighte­d with a differentl­y coloured border for easy identifica­tion.

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 possibilit­y of the project being straightfo­rward enough to help you learn the basics of the Go programmin­g language, are reasons enough to give it a fair shake.

 ??  ?? The author’s home city is experienci­ng an unpleasant haze, which translates into a dull representa­tion in the weather widget. California, on the other hand, is quite sunny.
The author’s home city is experienci­ng an unpleasant haze, which translates into a dull representa­tion in the weather widget. California, on the other hand, is quite sunny.
 ??  ??
 ??  ?? WTF will automatica­lly update the widgets as you edit the ~/.config/config. yml file, so you don’t have to constantly restart the tool for the changes to take effect.
WTF will automatica­lly update the widgets as you edit the ~/.config/config. yml file, so you don’t have to constantly restart the tool for the changes to take effect.

Newspapers in English

Newspapers from Australia