Skip to content

πŸš€ Termux Android Terminal Emulator - Fully converted to Kotlin! A modern, type-safe fork of the official termux-app with 100% Kotlin codebase.

License

Notifications You must be signed in to change notification settings

reapercanuk39/termux-kotlin-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,831 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Termux Kotlin App

CI Release GitHub Downloads Latest Release

Kotlin Android License Fork

The official Termux Android terminal emulator, fully converted to Kotlin!

Download APK

Features β€’ Installation β€’ Building β€’ Contributing β€’ Original Project


πŸ“± What is Termux?

Termux is a powerful Android terminal emulator and Linux environment app that works directly with no rooting or setup required. It provides a complete Linux environment on your Android device with access to:

  • 🐧 Linux shell (bash, zsh, fish)
  • πŸ“¦ Package manager (apt/pkg) with thousands of packages
  • 🐍 Programming languages (Python, Node.js, Ruby, Go, Rust, C/C++)
  • πŸ”§ Development tools (git, vim, nano, ssh, rsync)
  • 🌐 Networking utilities (curl, wget, nmap, netcat)

✨ What is Termux Kotlin App?

This repository is a complete Kotlin conversion of the official termux-app. Every Java file has been meticulously converted to idiomatic Kotlin while maintaining 100% compatibility with the original app.

πŸ“¦ Full Upstream Compatibility (v2.0.0+)

Termux Kotlin App uses the com.termux package name for 100% compatibility with upstream Termux packages. All packages install and work without any modification:

/data/data/com.termux/files/usr

What works:

  • βœ… pkg install python - Python 3.12.12 installs perfectly
  • βœ… pip install <package> - pip works out of the box
  • βœ… All upstream packages work without path rewriting
  • βœ… Uses official Termux bootstrap unchanged

Trade-off: Cannot be installed alongside the official Termux app (same package name, different signing key). This approach is inspired by ZeroTermux which uses the same strategy.

πŸ†• Kotlin Modernization

This fork focuses on:

  • 100% Kotlin codebase (converted from Java)
  • Modern Android development practices
  • AI agent integration for development assistance

πŸ€– Kotlin-Native Agent Daemon (v2.0.5+)

The agent framework now runs in pure Kotlin with zero Python dependency:

Feature Description
Auto-start Daemon starts automatically when app launches
45+ Capabilities Fine-grained permission system for agents
4 Pure Kotlin Skills pkg, fs, git, diagnostic
Swarm Intelligence Stigmergy-based multi-agent coordination
Python Fallback Complex skills gracefully degrade if Python missing

πŸ”Œ Integrated Plugins (v2.0.5+)

No more separate plugin APKs! These features are now built-in:

Plugin Status Features
Termux:Boot βœ… Built-in Auto-run scripts on device boot
Termux:Styling βœ… Built-in 11 color schemes, custom fonts, Compose UI
Termux:Widget βœ… Built-in 3 widget sizes, shortcut execution
Termux:API βœ… Built-in 20+ hardware APIs (battery, sensors, camera, etc.)
Termux:Tasker πŸ“‹ Planned Tasker integration

πŸ“¦ APK Size Explanation

Architecture APK Size Bootstrap Size
arm64-v8a ~35 MB 30 MB
armeabi-v7a ~32 MB 27 MB
x86_64 ~34 MB 29 MB
x86 ~34 MB 29 MB
universal ~130 MB All 4 combined

Why is it larger than original Termux?

The APK includes 66 packages rebuilt from source with native com.termux.kotlin paths. These packages have the correct paths compiled directly into the ELF binaries, ensuring:

  • βœ… SSL/TLS works immediately (libgnutls uses correct cert path)
  • βœ… Package management works out-of-box (apt/dpkg)
  • βœ… No runtime path-patching needed

The original Termux downloads these packages from their repository, while we bundle them for immediate functionality.

🌍 Proper Environment Configuration

The app automatically configures all necessary environment variables:

Category Variables Purpose
Core HOME, PREFIX, PATH, TMPDIR Basic terminal operation
Libraries LD_LIBRARY_PATH Override hardcoded RUNPATH in binaries
Terminal TERMINFO, TERM, COLORTERM Full terminal capability support
Package Manager DPKG_ADMINDIR, DPKG_DATADIR dpkg/apt path overrides
SSL/TLS SSL_CERT_FILE, CURL_CA_BUNDLE HTTPS mirror support

See ARCHITECTURE.md for the complete list.

🎯 Why Kotlin?

Feature Benefit
Null Safety Compile-time null checks prevent NullPointerExceptions
Concise Syntax ~40% less boilerplate code
Type Inference Cleaner, more readable code
Extension Functions Enhanced API without inheritance
Coroutines Ready Modern async programming support
Interoperability Seamless Java library compatibility

πŸ”„ Conversion Statistics

Component Java Files Converted Kotlin Files Created
app 40+ 40+
terminal-emulator 15+ 15+
terminal-view 10+ 10+
termux-shared 80+ 80+
Total 145+ 145+

πŸš€ Features

All original Termux features are preserved:

  • βœ… Full Linux terminal with touch/keyboard support
  • βœ… Package management via apt (pkg)
  • βœ… Session management with multiple terminal tabs
  • βœ… Customizable extra keys row
  • βœ… Styling support via Termux:Styling
  • βœ… Plugin ecosystem (Termux:API, Termux:Boot, Termux:Widget, etc.)
  • βœ… Hardware keyboard support with shortcuts
  • βœ… Background execution via Termux:Tasker
  • βœ… URL handling and file sharing

πŸ†• Kotlin-Exclusive Features

New features only available in the Kotlin version:

Feature Description
🎨 Jetpack Compose UI Modern declarative UI for settings and dialogs
πŸ” Command Palette VS Code-style fuzzy command search (Ctrl+Shift+P)
πŸ“ Split Terminal Side-by-side or top/bottom terminal panes
πŸ”‘ SSH Manager Save and manage SSH connection profiles
πŸ“œ Command History Searchable command history with statistics
⚑ Kotlin Coroutines Efficient async operations with Flow
πŸ’‰ Dependency Injection Hilt for clean architecture
πŸ’Ύ DataStore Modern preferences with reactive updates
🎭 Profile System Named profiles with theme, font, shell, and env vars
πŸ–ŒοΈ Theme Gallery 10+ built-in themes with live preview
πŸ’Ύ Package Backup Full backup/restore of packages, repos, and dotfiles
🩺 Package Doctor Health checks with auto-repair suggestions
πŸ› οΈ termuxctl CLI Unified CLI for backup, doctor, and profile management
πŸ“± Integrated Device API Built-in Termux:API - no separate APK needed
πŸ”’ HTTPS Support Proper SSL/TLS certificate configuration for secure mirrors
πŸ–₯️ Full Terminal Support TERMINFO configured for clear, tput, ncurses apps
πŸ€– Agent Framework Offline Python-based agent system with skills & capabilities

πŸ“± Integrated Device API (No Separate APK!)

Unlike standard Termux which requires installing the separate Termux:API APK, the Kotlin version has device APIs built directly into the main app:

# Battery status
termuxctl device battery
termuxctl device battery --json --extended

# List available APIs
termuxctl device list

# Coming soon: location, sensors, clipboard, camera, wifi, and more
termuxctl device location --provider gps
termuxctl device sensor --name accelerometer

Features:

  • βœ… Zero Setup - APIs work immediately after install
  • βœ… Coroutine-Based - Efficient async operations
  • βœ… Type-Safe - Sealed Result types and error handling
  • βœ… Unified Permissions - Integrated permission manager

See ARCHITECTURE.md for the full API list and implementation details.

πŸ—οΈ Modern Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       Compose UI Layer                       β”‚
β”‚      (Settings, Command Palette, SSH Manager, Dialogs)       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                  ViewModels + StateFlow                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                      Repositories                            β”‚
β”‚   (Settings, Sessions, History, SSH Profiles, Permissions)   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                      Core Modules                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   core/api   β”‚ β”‚ core/logging β”‚ β”‚   core/permissions   β”‚  β”‚
β”‚  β”‚ Sealed Types β”‚ β”‚TermuxLogger  β”‚ β”‚  PermissionManager   β”‚  β”‚
β”‚  β”‚ Result<T,E>  β”‚ β”‚ File Logging β”‚ β”‚  Activity Result API β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚core/terminal β”‚ β”‚ core/plugin  β”‚ β”‚  core/deviceapi      β”‚  β”‚
β”‚  β”‚  EventBus    β”‚ β”‚  Plugin API  β”‚ β”‚  Battery, Location   β”‚  β”‚
β”‚  β”‚ Flow Events  β”‚ β”‚ Versioning   β”‚ β”‚  Sensors, Camera...  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              DataStore / Coroutines / Hilt DI                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Modules

Module Description
core/api Type-safe Result<T,E> and sealed error hierarchies
core/logging Centralized logging with file output and Flow
core/permissions Unified permission handling with coroutines
core/terminal Flow-based event bus replacing callbacks
core/plugin Stable plugin API with semantic versioning
core/deviceapi Integrated device APIs (battery, location, sensors, etc.)
ui/settings Material 3 Compose settings with DataStore
pkg/backup Package backup/restore manager
pkg/doctor Package health diagnostics and auto-repair

🎨 Built-in Themes

10 beautiful themes included out of the box:

Theme Author Description
Dark Steel Termux Kotlin Signature dark theme with steel blue accents
Molten Blue Termux Kotlin GitHub-inspired dark theme
Obsidian Termux Kotlin VS Code-inspired dark theme
Dracula Zeno Rocha Popular dark theme
Nord Arctic Ice Studio Arctic north-bluish palette
Solarized Dark Ethan Schoonover Classic precision colors
Solarized Light Ethan Schoonover Light variant
Gruvbox Dark morhetz Retro groove palette
Gruvbox Light morhetz Light variant
High Contrast Termux Kotlin Maximum readability

πŸ’Ύ Package Management

Advanced package management features that surpass standard Termux:

# Create a full backup
termuxctl backup create --type full

# Restore with dry-run preview
termuxctl backup restore backup.json --dry-run

# Run package health diagnostics
termuxctl pkg doctor

# Auto-repair issues
termuxctl pkg doctor --auto-repair

πŸ€– Agent Framework

The Termux-Kotlin Agent Framework is a fully offline, Python-based agent system:

# Install Python (required)
pkg install python
pip install pyyaml

# List available agents
agent list

# Run a task through an agent
agent run debug_agent "apk.analyze" apk_path=/path/to/app.apk

# Show agent info and capabilities
agent info build_agent

# List available skills
agent skills

Built-in Agents:

Agent Purpose
build_agent Package building, CI scripts, build log analysis
debug_agent APK/ISO analysis, QEMU tests, binwalk
system_agent Storage check, bootstrap validation, environment repair
repo_agent Package repo sync, Packages.gz generation

Built-in Skills: pkg, git, fs, qemu, iso, apk, docker

Key Features:

  • πŸ”’ Offline-only - No external API calls, runs entirely locally
  • πŸ›‘οΈ Capability system - Fine-grained permissions (filesystem, network, exec)
  • πŸ“¦ Plugin architecture - Easy to add new skills
  • πŸ’Ύ Per-agent memory - JSON-based persistent storage
  • πŸ“ Sandboxing - Isolated directories per agent

See AI.md for complete documentation.

πŸ“₯ Installation

Download APK

Download the latest release APK from the Releases page.

Choose the appropriate variant for your device:

  • arm64-v8a - Modern 64-bit phones (most devices)
  • armeabi-v7a - Older 32-bit phones
  • x86_64 - 64-bit emulators/ChromeOS
  • x86 - 32-bit emulators
  • universal - Works on all (larger file size)

Build from Source

See Building section below.

πŸ”¨ Building

Prerequisites

  • JDK 17 or higher
  • Android SDK with Build Tools
  • Android NDK (for native components)

Build Commands

# Clone the repository
git clone https://github.com/reapercanuk39/termux-kotlin-app.git
cd termux-kotlin-app

# Build debug APK
./gradlew assembleDebug

# Build release APK (requires signing)
./gradlew assembleRelease

# APKs will be in app/build/outputs/apk/

Build Variants

Variant Description
debug Development build with debugging enabled
release Production build (requires signing)

πŸ”§ Custom Bootstrap

The app includes custom-built bootstraps with native com.termux.kotlin paths. To rebuild them:

# See full documentation
cat docs/CUSTOM_BOOTSTRAP_BUILD.md

# Quick overview:
# 1. Use Docker with termux/package-builder
# 2. Set TERMUX_APP__PACKAGE_NAME="com.termux.kotlin" in properties.sh
# 3. Build apt, dpkg, termux-exec, termux-tools, termux-core
# 4. Integrate into bootstrap zips

Pre-built packages are available in the repo/ directory.

πŸ”— Related Repositories

Repository Description
termux/termux-app 🏠 Original Termux app (Java)
reapercanuk39/termux-app 🍴 My fork of official repo
termux/termux-packages πŸ“¦ Package build scripts
termux/termux-api πŸ”Œ Android API access plugin

🀝 Contributing

Contributions are welcome! This project follows the same contribution guidelines as the original Termux project.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Follow Kotlin coding conventions
  • Use meaningful variable/function names
  • Add KDoc comments for public APIs
  • Prefer immutable (val) over mutable (var)

πŸ“‹ Original Project

This is a Kotlin conversion of the official Termux project:

All credit for the original implementation goes to the Termux team. This conversion aims to modernize the codebase while maintaining full compatibility.

πŸ“„ License

Termux Kotlin App - Android terminal emulator (Kotlin version)
Copyright (C) 2024 Termux Developers & Contributors

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.

Keywords: termux termux-app termux-kotlin android-terminal terminal-emulator linux-android kotlin-android android-app terminal shell bash linux android-terminal-emulator termux-android kotlin-conversion

Made with ❀️ by reapercanuk39

⭐ Star this repo if you find it useful!

About

πŸš€ Termux Android Terminal Emulator - Fully converted to Kotlin! A modern, type-safe fork of the official termux-app with 100% Kotlin codebase.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 85