Modern line-oriented terminal emulator without support for TUIs.

Overview

saneterm

Modern line-oriented terminal emulator without support for TUIs.

saneterm demo

Motivation

Mainstream terminal emulators (urxvt, xterm, alacritty, …) support a standard known as ANSI escape sequences. This standard defines several byte sequences to provide special control functions for terminals emulators. This includes control of the cursor, support for different colors, et cetera. They are often used to implement TUIs, e.g. using the ncurses library.

Many of these escape sequences operate on rows and columns and therefore require terminal emulators to be built around a character grid were individual cells can be modified. Historically, this was very useful to implement UIs on physical terminals like the VT100. Nowadays this approach feels dated and causes a variety of problems. For instance, the concept of grapheme cluster as used in Unicode is largely incompatible with fixed-size columns. For this reason, terminal emulator supporting the aforementioned escape sequences can never fully support Unicode [1].

On the other hand, a terminal emulator not supporting ANSI escape sequences can never support existing TUIs. However, the idea behind saneterm is that terminals shouldn't be used to implement TUIs anyhow, instead they should focus on line-based CLIs. By doing so, a variety of features normally implemented in CLI programs themselves (like readline-keybindings) can be implemented directly in the terminal emulator.

Status

Silly, buggy, and incomplete prototype implementation.

Features

By focusing on line-based input in the terminal emulator a variety of things can be simplified and improved. saneterm is presently just a prototype and provides basic implementations of the following features:

  • Full Unicode support
  • Support for readline-like line editing keybindings
  • Editing history support directly in the terminal emulator
  • File name completions
  • Pager-like text handling (scrolling, searching, …)

Installation

This software has the following dependencies:

If these are installed run the following command to install saneterm:

$ python3 setup.py install --optimize=1

For development setups just run python3 -msaneterm.

Usage

Since many modern day shells use ANSI escape sequences heavily for providing editing features, your favorite shell might not directly work with saneterm. Simple shells like dash are known to work well though. You might also want to consider using a clean environment, to do so run the following command to start saneterm:

$ saneterm -- env -i dash

Configuration

The terminal appearance can be configured using Gtk's CSS feature. The saneterm window widget can be selected using the CSS selector #saneterm.

For example, to change the color scheme and employed font. Add the following to your gtk.css configuration file located at $XDG_CONFIG_HOME/gtk-3.0/gtk.css:

#saneterm textview {
	font-family: Terminus;
	font-size: 16px;
}

#saneterm textview text {
	background-color: #181818;
	color: #d8d8d8;

	/* change cursor color too */
	caret-color: #d8d8d8;
}

Keybindings can be configured using the same mechanism, see keys.py for the default keybindings.

FAQ

Q: How do I edit text on remote machines over SSH if my terminal emulator doesn't support visual editors?

A: This is an interesting problem since a lot of software relies on TUIs to be used over PTYs and SSH on remote machines. This is mostly also an inherit flaw of Unix as it hasn't been designed with networking and GUIs in mind. Plan 9 solves this problem through 9P file servers, but unfortunately it has not been widely adopted and we are stuck with Unix. In the Unix world potential solutions include CLI-based editors (e.g. ed) or network protocols tunneled over SSH connections (e.g. Emacs Tramp Mode).

Q: How do I use pagers (e.g. less(1)) without support for TUIs?

A: With saneterm pagers are not needed as paging functionality is implemented in the terminal emulator itself. For this reason, saneterm offers a scrollback buffer in which autoscrolling can be configured using the Gtk context menu. Furthermore, word wrapping can also be disabled using the same mechanism. A search feature is also implemented and can be activated using ctrl+f.

Q: Why is this written in Python and not X?

A: This software is presently just a silly prototype, Python is good for prototyping. Furthermore, Python has decent, somewhat well-documented bindings for Gtk.

Related Work

This work is heavily inspired by the Plan 9 terminal emulator, usage of which is further described in the rio(1) man page. This terminal emulator was also ported to Unix as part of plan9port.

There are also a few projects which seem to share the problem statement outlined in the Motivation but propose different solution. Most of which include continued support for TUIs and therefore don't benefit from other line-based editing features. Non-complete list:

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt.

xonsh xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt. The language is a superset of Python 3.6+ with additio

xonsh 6.7k Jan 08, 2023
A CLI tools to get you started on any project in any language

Any Template A faster easier to Quick start any programming project. Installation pip3 install any-template Features No third party dependencies. Tem

Adwaith Rajesh 2 Jan 11, 2022
uploadgram uses your Telegram account to upload files up to 2GiB, from the Terminal.

uploadgram uploadgram uses your Telegram account to upload files up to 2GiB, from the Terminal. Heavily inspired by the telegram-upload Installing: pi

Shrimadhav U K 97 Jan 06, 2023
💥 Share files easily over your local network from the terminal!

Fileshare 📨 Share files easily over your local network from the terminal! 📨 Installation # clone the repo $ git clone https://github.com/dopevog/fil

Dopevog 11 Sep 10, 2021
Shellcode runner to execute malicious payload and bypass AV

buffshark-shellcode-runner Python Shellcode Runner to execute malicious payload and bypass AV This script utilizes mmap(for linux) and win api wrapper

Momo Lenard 9 Dec 29, 2022
Tncli - TON smart contract command line interface

Tncli TON smart contract command line interface State Not working, in active dev

Disintar IO 100 Dec 18, 2022
Unofficial Open Corporates CLI: OpenCorporates is a website that shares data on corporations under the copyleft Open Database License. This is an unofficial open corporates python command line tool.

Unofficial Open Corporates CLI OpenCorporates is a website that shares data on corporations under the copyleft Open Database License. This is an unoff

Richard Mwewa 30 Sep 08, 2022
Convert shellcode generated using pe_2_shellcode to cdb format.

pe2shc-to-cdb This tool will convert shellcode generated using pe_to_shellcode to cdb format. Cdb.exe is a LOLBIN which can help evade detection & app

mrd0x 75 Jan 05, 2023
A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool

Privateer A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool How

Shreyash Chavan 2 Apr 04, 2022
Simple subcommand CLIs with argparse

multicommand Simple subcommand CLIs with argparse. multicommand uses only the standard library and is ~150 lines of code (modulo comments and whitespa

Andrew Ross 10 Aug 01, 2022
Code for the Open Data Day 2022 publicbodies.org Nepal data scraping activities.

Open Data Day Publicbodies.org Nepal We've gathered on Saturday, 5th March 2022 with Open Knowledge Nepal in order to try and automate the collection

Augusto Herrmann 2 Mar 12, 2022
Custom 64 bit shellcode encoder that evades detection and removes some common badchars (\x00\x0a\x0d\x20)

x64-shellcode-encoder Custom 64 bit shellcode encoder that evades detection and removes some common badchars (\x00\x0a\x0d\x20) Usage Using a generato

Cole Houston 2 Jan 26, 2022
ICMP Reverse Shell written in Python 3 and with Scapy (backdoor/rev shell)

icmpdoor - ICMP Reverse Shell icmpdoor is an ICMP rev shell written in Python3 and scapy. Tested on Ubuntu 20.04, Debian 10 (Kali Linux), and Windows

Jeroen van Kessel 206 Dec 29, 2022
topalias - Linux alias generator from bash/zsh command history with statistics, written on Python.

topalias topalias - Linux alias generator from bash/zsh command history with statistics, written on Python. Features Generate short alias for popular

Sergey Chudakov 38 May 26, 2022
A simple command line tool for changing the icons of folders or files on MacOS.

Mac OS File Icon Changer Description A small and simple script to quickly change large amounts or a few files and folders icons to easily customize th

Eroxl 3 Jan 02, 2023
CLI utility for updating the EVE Online static data export in a postgres database

EVE SDE Postgres updater CLI utility for updating the EVE Online static data export postgres database. This has been tested with the Fuzzwork postgres

Markus Juopperi 1 Oct 29, 2021
CLI based Crunchyroll Account Checker Proxyless written in python from scratch.

A tool for checking Combolist of Crunchyroll accounts without proxies, It is written in Python from Scratch ,i.e, no external module is used rather than inbuilt Python modules.

Abhijeet 8 Dec 13, 2022
A simple Python library that allows you to customize your CLI based output on Linux

Terminal-Colored-Print About A small module that allows to simply decorate strings on Linux terminals. I personally use it for multi-threaded project,

Francesco Milano 0 Dec 13, 2021
Baseline is a cross-platform library and command-line utility that creates file-oriented baselines of your systems.

Baselining, on steroids! Baseline is a cross-platform library and command-line utility that creates file-oriented baselines of your systems. The proje

Nelson 4 Dec 09, 2022
A Python script for finding a food-truck based on latitude and longitude coordinates that you can run in your shell

Food Truck Finder Project Description This repository contains a Python script for finding a food-truck based on latitude and longitude coordinates th

1 Jan 22, 2022