Table of Contents
Alterm is a lightweight, minimal terminal emulator built using C++ and SDL2. It provides a simple and minimalistic interface for terminal operations, allowing users to execute basic shell commands, navigate directories, and utilize tab-based auto-completion for command and file names. The terminal emulator is designed to be lightweight and easy to use, making it suitable for various applications and environments.
-
PTY Shell Integration: Alterm leverages the POSIX PTY (Pseudo-Terminal) interface to create a virtual terminal, enabling seamless integration with the underlying operating system's shell. This allows Alterm to execute shell commands and interact with the terminal environment as if it were a regular terminal emulator.
-
Command History: Alterm maintains a command history, enabling users to easily navigate through previously executed commands using the up and down arrow keys. This feature provides a convenient way to access and reuse previous commands, enhancing productivity.
-
SDL2-based UI: Alterm utilizes the SDL2 library to create a graphical user interface (GUI) for the terminal emulator. This GUI provides a visually appealing and interactive experience, allowing users to interact with the terminal in a more intuitive manner.
-
Built-in Settings Mode (
settings,set,save,exit): Alterm allows users to access and modify its settings using thesettingscommand. This feature provides a convenient way to customize various aspects of the terminal emulator, such as colors, fonts, and other visual elements. -
Custom Font Rendering using
SDL_ttf**: Alterm supports custom font rendering using the SDL_ttf library. Users can specify a custom font file and apply it to the terminal emulator's UI, resulting in a visually appealing and tailored appearance. -
Auto-scroll & Scrollback
-
Live Cursor With Blinking Effect
These instructions will help you build and run alterm.
Make sure you have the following installed on you system:
-
g++ version 11 or higher
-
cmake version 3.21 or higher
-
SDL2 version 2.0 or higher
-
Unix-like environment (Linux, WSL, or macOS)
Clone the repository and build the project using the provided Makefile.
$ git clone https://github.com/zoldyck13/alterm.git
$ cd alterm
├── alterm/
│ ├── include/
│ │ ├── Alterm.hpp
│ │ ├── AnsFilter.hpp
│ │ ├── FontManagar.hpp
│ │ ├── forkpty.hpp
│ │ ├── HistoryManager.hpp
│ │ ├──SettingsManager.hpp
│ │
│ ├── src/
│ │ ├── Alterm.cpp
│ │ ├── AnsFilter.cpp
│ │ ├── FontManager.cpp
│ │ ├── forkpty.cpp
│ │ ├── HistoryManager.cpp
│ │ ├── main.cpp
│ │ ├── SettingsManager.cpp
│ │
│ │
│ │
│ ├── Makefile
│ ├── README.md
├ ├── LICENSE
├ ├──.alterm_history
├ ├── .alterm_settings
│ ├── assets/
│ │ ├── Fonts/
│ │ ├── Alterm.gif
│ │
│ │
$ make
This will build the source code and generate the executable ./alterm.
After building the project, run the terminal with:
$ ./alterm
You can enter:
-
** Shell commands** like ls, cd, top, etc.
-
Type
settingsto enter Settings Mode: -
set - change settings
-
save - write settings to .alterm_settings
-
exit - exit settings mode
settings
set font_size 16
save
exit
| Key | Description |
|---|---|
| font_size | Font size (int) |
| font_family | Path to TTF font |
| font_color_r/g/b | Font color (R, G, B) |
| bg_color_r/g/b | Background color (R, G, B) |
| bg_opacity | Background transparency (0–255) |
| auto_scroll | Enable/disable auto scroll |
-
Cursor navigation (<- / ->)
-
In-line text editing
-
Text selection and clipboard support
-
Command auto-completion and Tab completion
-
Mouse-based interaction
-
Syntax highlighting
-
ANSI escape sequences support
-
Deepen understanding of pseudo-terminal communication
-
Learn real-time rendering with SDL2
-
Create a customizable terminal-like interface from scratch
This project is licensed under the MIT License - see the LICENSE file for details.
