Skip to content

zoldyck13/alterm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents
  1. Alterm - Simple SDL2 Terminal Emulator

  2. Getting Started

  3. Project Structure
  4. Usage
  5. Settings Keys
  6. License
  7. Future Work
  8. What I Learned

Alterm - Simple SDL2 Terminal Emulator

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.

(back to top)

Features

  • 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 the settings command. 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

ScreenShots

(back to top)

Getting Started

These instructions will help you build and run alterm.

Prerequisites

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

  • SDL2_ttf

  • Unix-like environment (Linux, WSL, or macOS)

Building Alterm

Clone the repository and build the project using the provided Makefile.

$  git  clone  https://github.com/zoldyck13/alterm.git

$  cd  alterm

Project Structure


├── 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.

Running Alterm

After building the project, run the terminal with:

$  ./alterm

Usage

You can enter:

  • ** Shell commands** like ls, cd, top, etc.

  • Type settings to enter Settings Mode:

  • set - change settings

  • save - write settings to .alterm_settings

  • exit - exit settings mode

Example

settings

set  font_size  16

save

exit

Settings Keys

Settings Keys

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

Future Work

  • 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


What I Learned

  • Deepen understanding of pseudo-terminal communication

  • Learn real-time rendering with SDL2

  • Create a customizable terminal-like interface from scratch

Licnese

This project is licensed under the MIT License - see the LICENSE file for details.

About

Simple SDL2 Terminal Emulator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors