Hotwire blends the command line with the GUI

224

Author: Nathan Willis

Try to describe Hotwire, and you’ll eventually wind up saying something that sounds like an oxymoron, like “command-line GUI,” “graphical shell” or “GUI xterm.” Well, that’s pretty much what Hotwire is: something halfway between a text-based shell and a modern graphical user interface.

In part, the confusion stems from the fuzzy definition the typical desktop user has of the Unix shell. For the most part, it is transparent to us. We probably know that some commands (like ls and chown) are separate binaries, while others (like cd and umask) are actually internal functions provided by the shell. But unless we do a lot of scripting, it can be hard to remember which is which; we type whichever we need at the prompt and get back to business.

Given its low visibility, you might well ask whether the shell needs some updating for the 21st Century. Colin Walters thought so, so he created Hotwire to give it a push.

The basics

In a nutshell — and hopefully without oxymoron — Hotwire is a GUI app that you can use to execute commands. But where traditional Unix shells like bash and tcsh output plain text, Hotwire returns manipulatable GUI objects. Typing ls in bash returns a text list of the files in the current directory. Typing ls in Hotwire returns a window full of clickable contents, complete with sizes, modification times, ownership and permissions info, and even thumbnail icons.

Carrying the analogy one step forward, in bash you can chain the output of one command to the input of another with the pipe operator (|). You can do the same thing in Hotwire, but with the added bonus that the output you pipe is composed of smarter objects, and can thus be manipulated more intelligently.

Hotwire is written in Python, with an eye toward implementing common, everyday system administration tasks. It implements its own version of common shell functions and command-line programs, mostly dealing with file and directory management. In Hotwire nomenclature, these implementations are called builtins.

The current release (0.600) includes 21 builtins: cat, cd, cp, current, edit, filter, fsearch, help, history, ls, mkdir, mv, open, proc, prop, py, rm, sechash, sh, term, and write. The file management builtins output Python objects that are routed to Hotwire’s display canvas, which renders them in clickable GUI glory.

The ls builtin, for example, returns FilePath objects that can be rendered into a file-manager-like table for display, or can be passed on to the filter builtin (a grep replacement), which can search on individual properties of the files, as opposed to simple string matching.

Special builtins fill in the gaps where Hotwire does not yet have a builtin to substitute for a needed command. py executes Python code, sh executes arbitrary shell commands, and term opens a terminal inside a new tab.

Hotwire provides interactive niceties such as command and file name completion: as you type, matching commands or files appear in a floating window above the prompt, and you can select the one you want with the tab key.

Jump-starting

Hotwire is available prepackaged for Fedora, Ubuntu, Mandriva, Arch, and Debian, although the development pace is rapid enough that the individual distro packages may be out of date. It is just as easy to download the source package, unpack it, and run python ui/hotwire &.

On Linux systems, Hotwire hooks into a number of GNOME services, so you must ensure that you meet the dependencies, and have the proper Python packages installed. A complete list is maintained at the HotwireDevelopment page on the Hotwire wiki.

If you just wondered why I wrote “on Linux systems,” it’s because Hotwire runs on Windows too. The Windows port does not receive as much attention as the Linux branch, but if you install the prerequisite Python and GTK+ libraries, you can run it, and even help the developers keep it current.

Launch Hotwire, and you will see a standard GTK+ window with a menu bar on top, a large canvas area beneath it, a text box beneath that, and a drop-down menu at the very bottom.

You enter commands in the text box, and the results (in whatever form they may take) are rendered in the canvas area. Generally the results include an echo of the command entered at the top (in case you forget what it was), with some file listing occupying the rest of the space. The drop-down menu at the bottom always lists the current working directory. As you cd around, older locations are added to the menu, so you can quickly jump back to a previous location.

The best way to experience what distinguishes Hotwire from an xterm is to try out some typical commands. You’ll find, for example, that whenever you cd to a new directory, Hotwire automatically provides a directory listing. Double-clicking on a file in such a listing opens it in your environment’s default app for that file type, just as in Nautilus. Right-clicking gives you additional options.

Hotwire can execute individual shell commands with the sh builtin, but you cannot write traditional shell scripts for it. But that is no great loss, because you can write Python scripts instead. The Hotwire wiki has an excellent guide to getting started, beginning with on overview of the Hotwire architecture, continuing with basic pipelining, and moving on to writing your own extensions and builtins.

Get wired

Hotwire is still young. While the number of builtins is sure to expand with time, some tasks are easily expressed in a strictly linear command-line shell that simply do not translate well to the interactive 2-D world of Hotwire.

The project’s bug tracker mentions one peculiarity: rm, like many command-line programs, can accept a list of files (even in multiple directories) as an argument. Removing the specified files is no problem, but figuring out what result to display graphically is. And, in another potential problem, the current releases do not support remote execution or su/sudo. The code is being worked on, but the next version is not yet ready for public consumption — so don’t cast aside the lowly shell just yet.

But do give Hotwire a try; you may be surprised at the convenience it brings. Suddenly the CLI and the GUI aren’t two distant worlds separated by an impassable void. Since most of us desktop Linux users spend our time in a solid X Window environment, it makes sense to bring everyday shell operations along with us.

Categories:

  • Desktop Software
  • Tools & Utilities