Skip to content

CellerCity/X11-Terminal-Emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyTerm - A Custom Terminal with X11 GUI

Dependencies

To build and run MyTerm, you will need the following installed on your system (tested on Ubuntu-based systems):

GCC: The GNU C Compiler (usually installed by default). Make: The build automation tool (usually installed by default). X11 Development Libraries: Essential for compiling X11 applications. On Debian/Ubuntu: -> sudo apt-get update -> sudo apt-get install libx11-dev

Building the Shell

In the project directory, open the linux terminal. Give the launch.sh file the permission to execute using chmod:- -> chmod +x launch.sh Launch the shell using:- -> ./launch.sh

Features and Usage

Basic Interaction

Typing Commands: -> Enter commands as you would in a standard terminal.

Executing: -> Press Enter to execute the current command line.

Dynamic Prompt: -> The prompt shows username@myterm:current_directory> and updates automatically.

Scrolling: -> Use the Up/Down or (PgUp/PgDown) arrow keys or the mouse scroll wheel to scroll through the command output history within a tab.

Cursor: -> A blinking block cursor indicates the input position.

Window Resizing: -> The terminal layout adjusts vertically when the window is resized.

Tab Management

New Tab: -> Press Ctrl+T or click the + button next to the tabs.

Switch Tabs: -> Press Ctrl+Tab to cycle through open tabs, or click directly on a tab header.

Close Tab: -> Press Ctrl+W or click the X icon on the active tab header. -> The application closes automatically when the last tab is closed.

Command Execution Features

External Commands:

-> Standard Linux commands (e.g., ls, grep, gcc, ./myprog) are executed in a child process.

Built-in Commands:

cd [directory]: -> Changes the current working directory for the active tab. -> Supports ~, relative paths, absolute paths, and paths with spaces. -> Handles cd with no arguments to go to the home directory.

history: -> Displays the last 1000 commands executed (reads from ~/.myterm_history). Works in pipelines (e.g., history | grep cd).

clear: -> Clears the display buffer for the current tab.

exit: -> Closes the current tab.

multiWatch ["cmd1", "cmd2", ...] : -> Executes multiple commands in parallel and displays their output prefixed with a timestamp and command name. -> Press Ctrl+C to terminate if some command runs for a long time e.g. ping localhost.

Piping (|): -> Connect the standard output of one command to the standard input of the next (e.g., ls *.c | wc -l).

Redirection (<, >): -> Redirect standard input from a file or standard output to a file (e.g., ./myprog < input.txt > output.txt).

Multiline Input (): -> End a line with a backslash () to continue the command on the next line. -> The backslash itself is removed before execution.

Key Bindings

Enter: -> Execute the current command line.

Backspace: -> Delete the character before the cursor.

Left/Right Arrow: -> Move the cursor left or right.

Up/Down Arrow OR PgUp/PgDown: -> Scroll the display buffer up or down.

Ctrl+A: -> Move cursor to the start of the current command line (after the prompt).

Ctrl+E: -> Move cursor to the end of the current command line.

Ctrl+C: -> If a command is running: Sends SIGINT to the running process group to interrupt it. -> If at the prompt: Prints ^C and starts a new prompt line.

Ctrl+Z: -> If a command is running:- --> Sends SIGTSTP to the running process group to suspend it (job control). -> If at the prompt:- --> Prints ^Z and starts a new prompt line.

Ctrl+R: -> Enter history search mode. -> Type a search term and press Enter to find the most recent matching command.

Tab: -> Trigger filename auto-completion for the word under the cursor.

-> If one match:- 
    --> Completes the filename and adds a space (or / for directories).

-> If multiple matches:
    --> Completes up to the longest common prefix.
    --> If pressed again (or if prefix doesn't change), shows numbered options. Press a number key to select.

About

A lightweight, GUI-based terminal emulator built from scratch in C using Xlib (X11). Features include a custom process-group manager for simultaneous command monitoring (MultiWatch) and tabbed interface support.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages