Clicky

Blink Shell for iOS

August 10, 2017

Markdown Mode in Emacs on iPad via Blink Shell
Markdown Mode in Emacs on iPad via Blink Shell

Blink Shell is a unique and powerful shell app for iOS for connecting to remote hosts. Although it is perhaps not quite as polished as Prompt, my other favorite iOS SSH client, it has several features that Prompt does not.

When you first start Blink, there are no buttons or menus, as one expects from an iOS app. Instead, you are greeted with a cryptic blink> prompt in a black terminal with tiny white text.

This might be a bit disconcerting, but after a brief moment of panic, you will probably start to experiment with some commands. If you type an invalid command, Blink will inform you that you can type “help” to see a list of commands:

Blink: v7.0.1. Jul 11 2017

Available commands:
  mosh: mosh client.
  ssh: ssh client.
  ssh-copy-id: Copy an identity to the server.
  config: Configure Blink. Add keys, hosts, themes, etc...
  help: Prints this.
  exit: Close this shell.

Available gestures and keyboard shortcuts:
  two fingers tap or cmd+t: New shell.
  two fingers swipe down or cmd+w: Close shell.
  one finger swipe left/right or cmd+shift+[/]: Switch between shells.
  cmd+alt+N: Switch to shell number N.
  cmd+o: Switch to other screen (Airplay mode).
  cmd+shift+o: Move current shell to other screen (Airplay mode).
  cmd+,: Open config.
  pinch: Change font size.

If you have a Smart or Bluetooth keyboard attached—and you probably should to get the most out of Blink—then instead of typing a command you might try holding to see a list of keyboard shortcuts.

Blink Shell Keyboard Shortcuts
Blink Shell Keyboard Shortcuts

You can see that pressing ⌘, is an alternative to typing config to enter the app settings. Note that this is the same keyboard shortcut for opening the preferences window in most macOS applications. You can also do normal shell things like Control+L to clear, Control+D to log out, and so on.

Configuring and Connecting to Remote Hosts

Blink works with both SSH and Mosh, but before connecting to a remote host you should first import your SSH login keys and set the default username for SSH connections.

Configuring a New Host
Configuring a New Host

You can issue the ssh command with the usual flags, such as ssh -l <username> <hostname>, but you’ll want to configure frequently-accessed hosts for convenience. Each host is given an alias, say <host> instead of <hostname>, so that once configured you can simply type ssh <host> or mosh <host> to connect with the pre-configured hostname, username, port, etc.

SSH Connection Using a Host Alias
SSH Connection Using a Host Alias

SSH

For basic SSH access to a host, you’ll need provide the following:

Mosh: Mobile Shell

Most readers probably use SSH already but may not have heard of Mosh, which is much newer. Mosh is designed to provide robust remote connections with roaming when your IP changes (e.g., switching from WiFi to cellular) and intermittent connectivity. Mosh piggy-backs on top of SSH, so if you already have remote SSH access you only need to install a user-level mosh-server binary to enable Mosh access.

If you have installed Mosh on the remote host, then you may also need to provide the following:

If you use Homebrew on macOS, installing Mosh is as simple as this:

brew install mobile-shell

Customizing Modifier Keys: Caps Lock as Control

One of Blink’s most powerful features is the ability to customize the keyboard modifier keys. In fact, the reason I found Blink to begin with is it’s ability to use Caps Lock as a Control key (although there is an important caveat, discussed below).

Customizable Keyboard Modifier Keys
Customizable Keyboard Modifier Keys

If you set Caps Lock to be a Control key, there is a very important caveat: Caps Lock may be in an unexpected state when you leave and re-enter blink. This is due to the limitations of iOS development. There is a GitHub issue devoted to this problem if you’d like to read more about the technical details.

To summarize the issue, you can think in terms of two distinct Caps Lock states: one global in scope and one local. There is the iOS system-wide Caps Lock state and then the local state within the Blink app. If you are using Caps Lock as the control key, each time you press Caps Lock the system state is toggled but the Blink Caps Lock state remains off. The issue is that when you leave the Blink app, other apps honor the system state, which could be either on or off depending on whether you’ve pressed Caps Lock an even or odd number of times during your Blink session.

If you have an Apple wireless keyboard with a Caps Lock light, the light follows the system state every time you use Caps Lock in Blink, so this can at least help you track the state. Overall, I’ve found that the annoyance of this issue is small in comparison to the convenience of using Caps Lock as Control in Emacs and for other shell commands.

Another caveat is the small delay between when Caps Lock is pressed and when it is registered. When I quickly type control sequences as fast as I typically do—expecting no delay—the Control key part is not recognized. For example, to send ^C you’ll need to press Caps Lock and hold it for a fraction of a second longer than you typically might before pressing C. I don’t mean to overstate this issue, but I find that I do have to be more deliberate about entering control sequences.

Customization

There is a Blink Shell Theme Gallery with a huge selection of themes which you can access in Settings > Appearance > Add a new theme.

Appearance Settings
Appearance Settings

In the screenshot, I’m enjoying the Fira Code font—the same font I use in Emacs, yes, a monospaced font with programming ligatures—with the Arthur theme for Blink.

Customizable Keyboard Shortcuts
Customizable Keyboard Shortcuts

The keyboard shortcuts are also customizable. This includes the keys for switching to the previous and next shells, creating a new shell, closing a shell, and configuring Blink.

Getting Blink Shell

You can purchase the Blink Shell app on the App Store. Blink is also open source, so you can take a look at the source code on GitHub.2