How Teclada Works

The Host Daemon

The teclada package you install on your machine contains a "host daemon" and a configuration utility. The host daemon works a lot like sshd - it allows you to log into a terminal from a remote machine. However, it has one big improvement: like modern remote access software, it connects outward, meaning there's no need to set up firewalls, port forwarding, NAT punching, etc.

In The Browser

Command Input

The command input box isn't a Terminal input box - it's a regular web text box. This means that everything you expect from the web, like mouse selection, works out-of-the-box.

Background Tasks

With a regular shell, the output of background tasks run with & will be mixed up with subsequent commands. Many interactive commands like vim simply can't be run in the background at all. This happens because the shell runs inside something called a "pseudoterminal" (pty) started by the terminal, a special kind of pipe that handles interaction like cursor position and Ctrl+C. Every process runs in the same pty.

In Teclada, we give each command its own pty. This allows us to keep background output entirely separate from foreground output. In fact, Teclada really doesn't have much difference at all between "background" and "foreground" commands.

Running every command in its own pty has some other advantages too. You'll never need to run reset, for example, because a previous command will never break your pty.

Interactive Commands

Since each command runs with its own pty, each command needs separate interactivity behavior: two interactive commands can have different cursor positions, for example. We accomplish this by running every interactive command in its own xterm.js "terminal" inside of Teclada.