Giter Site home page Giter Site logo

tuzig / terminal7 Goto Github PK

View Code? Open in Web Editor NEW
151.0 7.0 20.0 42.69 MB

A Next Generation Terminal running over WebRTC

Home Page: https://terminal7.dev

License: GNU General Public License v3.0

JavaScript 11.70% HTML 2.01% CSS 6.03% Ruby 0.36% Swift 1.71% Java 0.25% TypeScript 75.73% Dockerfile 0.31% Shell 1.90%

terminal7's Introduction

Terminal7 - A touchable terminal multiplexer running over WebRTC

Screen Shot 2022-01-06 at 22 31 04

Tests License Platform Languages Closed Issue Open Issues

Terminal7 is a terminal that includes a terminal multiplexer made for modern web clients and real time communications over WebRTC. A reincaranation of tmux and screen, Terminal7 is a hybrid app that designed for smart clients.

The code here is in vanilla TypeSctipt, relying chiefly on the following projects:

  • CapacitorJS for app packaging & plugins
  • Xterm.js for terminal emulation
  • noble-ed25519 for key generation
  • pion.ly for the WebRTC backend
  • Vite for packaging
  • Vitest for testing
  • Docker compose for acceptance tests
  • Playwright for end-to-end tests
  • MailHog for an SMRP test double

For networking we use SSH or WebRTC, the web standard for real time communications. WebRTC is UDP based with wide support and a great implmentation in go - pion/webrtc - that we use as a base for our server's agent.

If you're having problems with your first connection, please refer to our troubleshooting guide.

We welcome new contributors and are happy to help, talk to us on our discord server.

Getting Started

You can get Terminal7 for free from the App Store or Google Play.

To run from source, you should start by forking the repo (or using tuzig/terminal7 if you just want to test), cloning it and from it's root run:

yarn install
yarn test
yarn start

then point your browser at the printed URL, usually http://localhost:5173.

Installing the server

To connect from the browser you'll need the webexec agent running. webexec is an open source WebRTC server written in go and based on pion. Terminal7 should offer to install it for you, but if it doesn't, open TWR and run install to ensure your agent is up.

If you that doesn't work you can install webexec using go:

go install github.com/tuzig/webexec@latest
webexec start

If you don't have go, you can use our line installer to download the binary for your system and start it:

  bash <(curl -sL https://get.webexec.sh)

webexec will start an HTTP WHIP server on port 7777, waiting for the client to connect. If pperbook user is set, webexec will also connect to peerbook.io so it can accept connections even when behind-the-NAT.

webexec's CLI has a growing set of commands, use webexec to get help on the current set.

Clipboard integration

Terminal7 has a clipboard integration that works over WebRTC. From the CLI you can:

  • webexec copy < FILE to get the file into the client's clipboard
  • webexec paste to print rhe client's clipboard to stdout

If no peer are actives, e.g. you're using a classic terminal, webexec will look for the tools:

  • pbcopy, pbpaste on MacOS
  • xclip, xsel on Linux

neovim integration will let you use use the + and * named buffer to copy to and from the clipboard. Just 12 lines in your init.lua:

    vim.g.clipboard = {
        name = 'webexec',
        copy = {
            ["+"] = {'webexec', 'copy'},
            ["*"] = {'webexec', 'copy'},
        },
        paste = {
            ["+"] = {'webexec', 'paste'},
            ["*"] = {'webexec', 'paste'},
        },
        cache_enabled = true,
    }

When webexec is not install, neovim will try the default clipboard tools like xclip or pbcopy.

Running the acceptance tests

TL;DR: run docker and ./aatp/run

Terminal7 has a suite of acceptance tests that run over a docker compose virtual lab. They include end-to-end tests and run on PRs to ensure the code is solid. To learn more about the tests, please refer to ./aatp/README.md documentation.

terminal7's People

Contributors

akariv avatar daonb avatar dependabot[bot] avatar dmitryporotov avatar erezhod avatar eyal-sasson avatar mesteery avatar ralfkeller avatar shech2 avatar superduperalon avatar yaelih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

terminal7's Issues

Handle window.onresize

When I flip my tablet, the layout stay the same but the size in rows and cols changes. When this happens we need to call fit() on all panes and send the new sizes. This requires API changes - adding support for an array as the value of resize_pty.

Add index.html to the test

Today the tests runs with an empty index.html as a result all the code that adds elements to the screen is enclosed in an if (elem != null) . It's not only an eye sore, but it also means that there's quite a bit of code that is not covered by the tests.

Make the Looking glass work

Clicking the looking glass should turn the nav bar into an input field and let me key for a search string. After each letter I key, matched strings are scrolled to and highlighted in the active pane.

Clicking enter looks for the previous match in the terminal buffer.

Loosing gestures after zoom-in-out

To recreate start with a |- layout and choose the bottom left pane. zoom in, zoom out. Swipe on one of the other panes and you get... nothing. I suspect zooming in confuses hammerjs and we need to either find a better way to zoom or reset hammerjs on all the other panes after zoom out.

Support The Clipbboard

This issue is waiting for tuzig/webexec#29 

webexec's API will add get_clipboard and
set_clipboard commands. This should allow the user
off a properly configured nvim to yank a line vim
and get it in the iPad's clipboard.

Add a server command to the welcome message

Here' the message:


To start a connection run this command on your server and enter its IP addres:

$ webexec <offer>

dev host address: __________


The is the same offer we use in the body of a post to /connect. When the user enters the address, t7 will try to connect to the server.

Fix zoom

Zoom-in-zoom-out works only once.

Add a leader key

Today, all the commands are just CTRL key combination. For example CTRL-z is used to zoom in. The problem with that is that CTRL-z is important for the shell and we should be smarter and imitate tmux that have a leader key used as prefix to all command keys. The default leader is CTRL-b but most people change it to CTRL-a which should be out default leader.

Make CSS meaningful and responsive

We need to support both iPad screen sizes in portrait & landscape orientation. In the future we'll have more screen sizes so it's better to make it responsive.

To recommended process is:

  • learn the design
  • come up with a sensible hierarchy
  • ensure meaningful names
  • code it all in src/css/terminal7.css
  • open a PR

Handle tab names overflow

When opening many tabs the tab bar is running out of space and tab names are displayed on the the navbar. Instead we should have a burger button, that holds the window names that don't fit the screen, like Tab 6 and Tab 7 below :

image

Add re-sizing notification

To keep things transparent and to make sure our resize works (which probably doesn't...) we need to add an indication of size change. When we get an Ack on a resize request we will display, roughly at the center of the pane the new dimensions as in "24x80" for a second and fade it away.

Add the "new window" button

We're missing a button - a + - displayed at the right of the #tabbar . Clicking on the button will create a new window with a single, focused pane. For now, use numbers for the window name. Renaming windows is another issue.

Support pinch

Pinch will let the user change a pane's font size. When the gesture ends, fit() should be called on all the cells so that terminals will grow to fill their containing element.

Store & restore the windows layout

Windows layout should be saved to local storage and read when re-connecting to the server. The layout is removed from storage only when the user asks to close the host.

Use two fingers to scroll

Using a single finger to scroll makes terminal7 split vertically occasionally. By switching to two fingers scrolling we avoid the confusion and making sure scrolling won't split the pane.

Add a chaos monkey test

Write a test that splits a few times and than close the panes in random. Assert the last pane takes the entire screen and that document is clean.

When zoomed in disconnect modal doesn't show

to recreate: zoom in on a pane, disconnect the wifi. wait 5 seconds and press and zoom out. The disconnect dialog is there, it's probably with a lower z-index than the zoomed pane.

Serialize layouts to/from tmux format

For easier debugging and tmux compatibility we need text serialization. Here's what it looks like in tmux:

0c36,173x44,0,0{80x44,0,0,4,92x44,81,0[92x21,81,0,5,92x22,81,22,29]}]

The first number is a checksum, followed by size of offsets of every cell with {} to donate a vertical split groups of cells and [] for horizontal one.

Support key repeat

Today, when you hold a key down you get the key you pressed only once.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.