3 min read

Windows 8 Modern Terminal

The sandboxed limitations of Windows 8 Modern UI applications is fairly well known. Unfortunately, this means that it is impossible to write a Modern UI terminal in the way that we would normally. On the other hand, there are really good motivations for getting a terminal in the Modern UI. Firstly, console applications and the Modern UI actually go pretty well together. Full screen applications were the norm back in the days of the console, and many of them would interact fairly well with normal Windows applications. They wouldn't be fully Modern, but they would integrate remarkably well, and it would be better than having annoying terminal windows all over the place. There are two ways to get this done.

Either we could have a Windows Terminal in a Modern UI, or we could port each of the applications we care about to run in the Modern UI with a console interface. Since I do not have the time right now to do such ports, and add interesting modern ui features to these classic applications, I figure that getting a Windows Terminal is the better choice.

But wait, didn't I just say that this is a well known and impossible problem? Well, it is impossible to do it in the normal way, but this does not mean that we cannot operate in some other way. In particular, I'll point out how I achieve this on my system, and why I want it.

There is one text editor that I really like to use which I miss on Windows, this is not Vim or Emacs, but rather, the JOE editor. It's Wordstar-like interface is the best one that I have found for when I am in a Wordstar mood, and there isn't anything else like it for Windows right now. Otherwise, I also write documents using DocBook, and this requires a post-processing phase to get the results into PDF or HTML format. And sometimes it is nice to be able to just interactively run some commands on a terminal.

The solution turns out to be both very simple, and also a little more complicated than you would expect. The basic idea is to run a terminal emulator to remotely connect to your local machine over SSH or Telnet. This creates a client server interface between your Windows Modern UI terminal emulator and the local machine.

Of course, this technique is obviously a potential attack vector that could be used to compromize the sandboxed environment of the Windows 8 Modern applications. So, naturally, this is disabled by default. A Modern UI application cannot actually connect to the localhost. Imagine that. Fortunately, an application called Fiddler2 actually has a nice feature that allows you to selectively open up localhost access for selected Modern UI applications. This allows you to take advantage of the sandboxing while still opening up the applications that you want. In this case, I only open up the Terminal application that I am using.

The Windows store contains two good terminal emulators that I am trying out. I have not yet decided which one will get my money, but they both work reliably. These are SSH-RT and Remote Terminal. Both of them support SSH and Telnet, which is important, though they each have their unique advantages and disadvantages.

Once you have the terminal, you just have to set up the servers. In my case, I used Cygwin to set up a UNIX-like environment to run an SSHD service for running my JOE editor. I basically log into my session and start up Jstar. :-) Cygwin has good instructions on how to get this done, and you can compile the latest source from JOE to get things working. I had to copy my local config.guess into the source tree of JOE to get it to recognize the cygwin build environment, but that's something unique to my own situation.

Windows also comes with a built-in Telnet server that you can enable in the Programs and Features control panel. Once you have added your user to the Telnet Client group, you can log in using the terminal emulator of your choice. Once you have this working, then you have a session for running your UNIX applications and a session for running your Windows console applications.

It's all a bit convoluted, but otherwise it works remarkably well and I'm glad that I have this capability now. It's much nicer to have the terminals in the Modern UI and in full screen all the time, rather than using the terminals in the desktop, as I generally have other applications that I want to use in the desktop that I do not want to have to manage together with my terminals.