Skip to main content

BDH Terminal Engine

bdh-terminal-engine

A 100% Pure Linux CLI Terminal Multiplexer & Standalone Text Editor Architected and built using an AI-orchestrated, low-level C workflow.

Built specifically for backend developers, systems engineers, and CLI enthusiasts.

License: MIT Language Platform Zero Dependencies Build


Overview

BDH Terminal Engine is a lightweight, high-performance terminal multiplexer inspired by tools like tmux and GNU screen, bundled with a built-in, standalone modal text editor.

Architected from the ground up to interact directly with Linux kernel pseudo-terminals (PTY), it manages virtual screen rendering, integrated text editing, and seamless text-based web browsing — right inside your active terminal pane, with zero GUI dependencies.


Key Features

Feature
True Multi-Tab & Multi-Shell Multiplexing — Spawn and manage multiple concurrent /bin/zsh or /bin/bash PTY sessions inside a single terminal window with instant keyboard and mouse switching.
Built-in & Standalone Modal Text Editor (bdh-edit) — A fully functional, lightweight VT100 text editor. Launch it standalone via bdh-edit <filename> from any shell, or toggle it instantly inside the multiplexer with Ctrl + E — complete with a blinking block cursor (█) and clean alternate-screen isolation.
Responsive Multi-Platform Capacity — Linux Desktop/Server Mode supports up to 18 concurrent sessions (MAX_SESSIONS 18); Termux/Mobile Mode is optimized for 8 concurrent sessions (MAX_SESSIONS 8) for a clutter-free mobile layout.
XTerm SGR Mouse Protocol Support — Click directly on any tab in the top badge or footer overlay to switch active sessions instantly, no keyboard required.
Built-in Token Scanner (Ctrl + K) — Dynamically scan the entire screen for URLs, IP addresses, UUIDs, and file paths, and copy them straight to your clipboard.
Pure CLI Web Browser Integration — Browse documentation, GitHub repos, and websites inside your active tab, rendered in sharp, glitch-free ASCII/VT100 text mode (Ctrl + B).
Non-Blocking Asynchronous I/O & Zero-Gap Footer — Powered by a responsive select() event loop with a 10ms timeout for zero input latency, with a permanent, zero-gap Active Sessions Manager footer.
16KB Anti-Glitch & Anti-Tearing Buffer — A high-capacity 16,384-byte I/O buffer eliminates screen tearing, flickering, and ghosting during heavy stdout bursts or full-screen browser layouts.
Lightweight & Zero Bloat — Compiles to tiny binaries (bdh-engine and bdh-edit). No X11, Wayland, GTK, or WebKit dependencies — runs flawlessly on servers, SSH sessions, TTYs, Termux, and Linux desktops.

Modular Architecture

The engine is structured into clean, decoupled C modules for maintainability and extensibility:

Module Source File Core Responsibility
PTY Engine src/engine/pty.c Forking processes and creating pseudo-terminals (pty_spawn) via Linux system calls.
Session Manager src/engine/session.c Initializing, managing, and cleaning up multi-tab lifecycle arrays (8 to 18 sessions).
Virtual Screen src/engine/screen.c, src/ui/panes.c Detecting real terminal dimensions (ioctl) and maintaining off-screen window buffers.
ANSI / VT100 Parser src/engine/parser.c Parsing terminal escape sequences, CSI codes, cursor positioning, and line clearing.
Text Editor Engine src/editor/edit.c, src/edit_main.c Lightweight CLI text editing, row buffer rendering, file I/O, and standalone binary execution.
Mouse Parser src/engine/mouse.c Decoding XTerm SGR mouse events (\033[<btn;col;rowM) for instant UI interaction.
Input & Clipboard src/engine/input.c, src/engine/clipboard.c Handling raw keyboard shortcuts, mouse events, tab switching, copy/paste, and browser execution.
Token Scanner src/engine/scanner.c Extracting structured tokens (URLs, IPs, paths) from the screen buffer into clipboard storage.
Footer & Tabs UI src/ui/tabs.c, src/ui/statusbar.c Rendering the zero-gap BDH Active Sessions Manager footer box and status indicators.
Renderer src/engine/renderer.c Efficiently flushing the virtual screen state to the physical terminal without flickering.
Terminal Control src/engine/terminal.c Managing Linux terminal Raw Mode and restoring canonical settings cleanly on exit.

⚙️ Prerequisites & Installation

1. Install System Dependencies

Arch Linux / Manjaro

sudo pacman -S --needed gcc make links

Ubuntu / Debian

sudo apt update && sudo apt install -y build-essential links

Termux (Android)

pkg update && pkg install -y clang make links

2. Build & Install the Project

Clone the repository and compile using the included Makefile:

# Clone the repository
git clone https://github.com/BackendDeveloperHub/bdh-terminal-engine.git
cd bdh-terminal-engine

# Build clean executables and install globally
make clean && make && sudo make install

Note for Termux users: Run make clean && make && make install (without sudo).


Usage

1. Start the Multiplexer Engine

Launch the terminal engine directly from any shell. You can optionally pass a filename to open it immediately in the built-in editor:

bdh-engine [optional_filename.txt]

2. Launch the Standalone Text Editor

Open or create a file using the standalone CLI text editor directly from your standard terminal:

bdh-edit filename.txt

Controls & Keybindings

Shortcut / Action Description
Ctrl + A Switch to the next active Tab / Session sequentially.
Ctrl + E Toggle the built-in full-screen modal text editor on/off.
Ctrl + B Launch the CLI Web Browser (links) inside the currently active tab.
Ctrl + K Trigger the Token Scanner to extract and copy URLs/IPs from the screen.
Ctrl + S Save the active file (while in Editor Mode).
Ctrl + X Exit Editor Mode and return to the multiplexer shell.
Ctrl + Q Safely terminate the engine and restore canonical terminal settings.
Mouse Left Click Click on any session tab to switch directly to that session.

Engineering Notes

Early iterations of bdh-terminal-engine experimented with embedded graphical WebKitGTK windows. However, GUI loops (gtk_main_quit) clashed with the low-level PTY select() loop, adding megabytes of bloat and restricting usage strictly to desktop environments.

By refactoring to a 100% Pure Linux CLI Multiplexer & Modal Editor, the engine achieved:

  • Zero Crash Rate — Removed all display server (DISPLAY=:0) and GTK signal errors.
  • Server & Mobile Ready — Perfectly functional over headless SSH connections, minimal Arch Linux installations, and Termux mobile environments.
  • High Performance — Reduced binary size and memory footprint by over 99%.

Roadmap

  • Session persistence / detach-reattach support
  • Configurable keybindings via ~/.bdhrc
  • Split-pane layouts within a single tab
  • Syntax highlighting in bdh-edit

Contributing

Contributions, issues, and feature requests are welcome. Feel free to check the issues page or open a PR against the modular source tree above.


License

Distributed under the GNU GENERAL PUBLIC LICENSE License. See LICENSE for more information.


Author & Workflow

Prabakaran P — Backend Developer Hub (BDH Linux) Systems Architecture & Engineering Design · AI-Assisted Low-Level C Implementation · Python / FastAPI

A Note on Modern Engineering: This engine was conceptualized, architected, and debugged using an AI-assisted systems engineering workflow — combining human architectural vision with AI-driven code generation for rapid, low-level C development.

⭐ If you find this project useful, consider giving it a star on GitHub!

Release files for bdh-terminal-engine 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bdh-terminal-engine 0.0.5
File Size Uploaded
bdh_terminal_engine-0.0.5.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bdh-terminal-engine 0.0.5
File Interpreter ABI Platform
bdh_terminal_engine-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 36.6 kB

Release files / bdh_terminal_engine-0.0.5.tar.gz

Download URL bdh_terminal_engine-0.0.5.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
01216ef634145e84b9228b717dc113bb6c2c0ccff323f816bd0392224878f95a
BLAKE2b-256 checksum
How to use checksums
ea3fe823e5c6e3e8e6f315b7f33a1b26689956961c45c70e400f4b161677ab92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / bdh_terminal_engine-0.0.5-py3-none-any.whl

Download URL bdh_terminal_engine-0.0.5-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfdecdf915d65a112664eb1d2f9aedf8ad4a92dbcca210450378ca5ebfd94410
BLAKE2b-256 checksum
How to use checksums
41361a6ef4aac268b34a1867bd785f0c7e0a7b569782536f7ad342a08354cd86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page