A plugin for Termux to use native Android GUI components from CLI applications.

Last update: May 10, 2022

Termux:GUI

This is a plugin for Termux that enables command line programs to use the native android GUI.

In the examples directory you can find demo videos and sample code.

There are also prepackaged programs you can use.

Installation notes
There is currently no release on f-droid, so the only method to install this plugin is to use the apk from the releases and the Termux apk from Github Actions.
Releases on f-droid will be provided as soon as possible. When there is a release, the f-droid badge at the top will show a version number. The f-droid builds currently don't work, Github builds are the only option for now.
See this comment for links to install Termux and its plugins from Github.

Protocol.md describes the Protocol used and the available functions you can use.
If you want to use overlay windows or be able to open windows from the background, go into the app settings for Termux:GUI, open the advanced section and enable "Display over other apps".

Comparison with native apps

Native app With Termux:GUI
Has to be installed Program can be run in Termux
Full access to the Android API Access to the Android API through Termux:GUI and Termux:API
Limited to C, C++, Kotlin and Java for native development Any programming language can be used, prebuilt library for python available
Lower performance caused by IPC
Accessing files in Termux only possible via SAF Direct access to files in Termux
Has to be started with am from Termux Can be started like any other program in Termux
Can receive command line arguments and output back to the Terminal

Language Bindings

Using the plugin

Using this plugin requires a bit of knowledge of the Android GUI system. You can read about it in detail in the official documentation.
Relevant documentation is also linked in Protocol.md for more specific subjects.
Here is a crash-course:

Tasks

Tasks are the individual screens you can switch between. Each Task has a stack of Activities, called the back stack, with the top one being visible.

Activities

Activities are the individual screens of apps, like a home screen, a settings screen etc.
When an Activity finishes itself, it is removed from the Activity stack of its Task, showing the underlying Activity.
An Activity can also launch another Activity in the Task, adding it to the back stack on top of itself.
To not let the device do unneeded work like drawing Elements that aren't visible, the System informs Activities of certain changes.
These are the Activity lifecycle events.

Activity Lifecycle

The most important lifecycle events for you will be onDestroy, onStart and onStop. When an Activity is started, it is visible. An Activity is destroyed if the user finishes it (by dismissing it), when it finishes itself or when a configuration change occurs.
The plugin will tell you if the Activity is finishing when onDestroy is fired, so you know the Activity will be closed.
Configuration changes are handled for you, so you don't need to worry about onDestroy if the Activity is not finishing.

Views

Views are the Elements that are displayed in Activities.
They are divided into Views and Viewgroups, which can themselves contain Views or Viewgroups.
That results in a hierarchy of Elements, with one at the top.
The Viewgroups are Layouts that position the contained Views according to your configuration.

The most used Layout is LinearLayout. It simply displays Views in a horizontal or vertical list, giving each Element the same space by default.
TextViews can display text.
EditText can get text input from the user.
Buttons can be clicked.
ImageViews can display images.

With these fundamentals you can go ahead and use this plugin. If you need more sophisticated Views or Layouts look into Protocol.md for what's available.

GitHub

https://github.com/termux/termux-gui
Comments
  • 1. Cannot install by myself signed.

    Because Termux did not provide a pre-compiled package before, and I added two fonts to the Styling plugin, so I have always used the APK editor to sign by myself. But now not only the GUI plugin cannot be installed, the latest version of the Widget, the API plug-in is also cannot be installed.

    here is my info

    ## Termux App Info
    
    **APP_NAME**: `Termux`  
    **PACKAGE_NAME**: `com.termux`  
    **VERSION_NAME**: `0.118.0`  
    **VERSION_CODE**: `118`  
    **TARGET_SDK**: `28`  
    **IS_DEBUGGABLE_BUILD**: `false`  
    **APK_RELEASE**: `Unknown`  
    **SIGNING_CERTIFICATE_SHA256_DIGEST**: `A40DA80A59D170CAA950CF15C18C454D47A39B26989D8B640ECD745BA71BF5DC`  
    ##
    
    
    ## Termux:API App Info
    
    **APP_NAME**: `Termux:API`  
    **PACKAGE_NAME**: `com.termux.api`  
    **VERSION_NAME**: `0.49`  
    **VERSION_CODE**: `49`  
    **TARGET_SDK**: `28`  
    **IS_DEBUGGABLE_BUILD**: `false`  
    **APK_RELEASE**: `Unknown`  
    **SIGNING_CERTIFICATE_SHA256_DIGEST**: `A40DA80A59D170CAA950CF15C18C454D47A39B26989D8B640ECD745BA71BF5DC`  
    ##
    
    
    ## Termux:Styling App Info
    
    **APP_NAME**: `Termux:Styling`  
    **PACKAGE_NAME**: `com.termux.styling`  
    **VERSION_NAME**: `0.29`  
    **VERSION_CODE**: `29`  
    **TARGET_SDK**: `28`  
    **IS_DEBUGGABLE_BUILD**: `false`  
    **APK_RELEASE**: `Unknown`  
    **SIGNING_CERTIFICATE_SHA256_DIGEST**: `A40DA80A59D170CAA950CF15C18C454D47A39B26989D8B640ECD745BA71BF5DC`  
    ##
    
    
    ## Termux:Widget App Info
    
    **APP_NAME**: `Termux:Widget`  
    **PACKAGE_NAME**: `com.termux.widget`  
    **VERSION_NAME**: `0.12`  
    **VERSION_CODE**: `12`  
    **TARGET_SDK**: `28`  
    **IS_DEBUGGABLE_BUILD**: `false`  
    **APK_RELEASE**: `Unknown`  
    **SIGNING_CERTIFICATE_SHA256_DIGEST**: `A40DA80A59D170CAA950CF15C18C454D47A39B26989D8B640ECD745BA71BF5DC`  
    ##
    
    
    ## Device Info
    
    ### Software
    
    **OS_VERSION**: `4.19.113-perf-g18f438a3f5fe`  
    **SDK_INT**: `30`  
    **RELEASE**: `11`  
    **ID**: `RKQ1.200826.002`  
    **DISPLAY**: `RKQ1.200826.002 test-keys`  
    **INCREMENTAL**: `V12.5.7.0.RJSCNXM`  
    **SECURITY_PATCH**: `2022-01-01`  
    **IS_DEBUGGABLE**: `0`  
    **IS_TREBLE_ENABLED**: `true`  
    **TYPE**: `user`  
    **TAGS**: `release-keys`  
    
    ### Hardware
    
    **MANUFACTURER**: `Xiaomi`  
    **BRAND**: `Redmi`  
    **MODEL**: `M2007J17C`  
    **PRODUCT**: `gauguinpro`  
    **BOARD**: `gauguinpro`  
    **HARDWARE**: `qcom`  
    **DEVICE**: `gauguinpro`  
    **SUPPORTED_ABIS**: `arm64-v8a, armeabi-v7a, armeabi`  
    ##
    
    
    ## Important Links
    
    ### Github
    
    [Termux](https://github.com/termux/termux-app)  
    [Termux:API](https://github.com/termux/termux-api)  
    [Termux:Boot](https://github.com/termux/termux-boot)  
    [Termux:Float](https://github.com/termux/termux-float)  
    [Termux:Styling](https://github.com/termux/termux-styling)  
    [Termux:Tasker](https://github.com/termux/termux-tasker)  
    [Termux:Widget](https://github.com/termux/termux-widget)  
    [termux-packages](https://github.com/termux/termux-packages)  
    
    ### Email
    
    [[email protected]](mailto:[email protected])  
    
    ### Reddit
    
    [r/termux](https://www.reddit.com/r/termux)  
    
    ### Wiki
    
    [Termux Wiki](https://wiki.termux.com)  
    [Termux](https://github.com/termux/termux-app/wiki)  
    [termu## Termux App Info
    
    **APP_NAME**: `Termux`  
    **PACKAGE_NAME**: `com.termux`  
    **VERSION_NAME**: `0.118.0`  
    **VERSION_CODE**: `118`  
    **TARGET_SDK**: `28`  
    **IS_DEBUGGABLE_BUILD**: `false`  
    **APK_RELEASE**: `Unknown`  
    **SIGNING_CERTIFICATE_SHA256_DIGEST**: `A40DA80A59D170CAA950CF15C18C454D47A39B26989D8B640ECD745BA71BF5DC`  
    ##
    
    
    ## Termux:API App Info
    
    **APP_NAME**: `Termux:API`  
    **PACKAGE_NAME**: `com.termux.api`  
    **VERSION_NAME**: `0.49`  
    **VERSION_CODE**: `49`  
    **TARGET_SDK**: `28`  
    **IS_DEBUGGABLE_BUILD**: `false`  
    **APK_RELEASE**: `Unknown`  
    **SIGNING_CERTIFICATE_SHA256_DIGEST**: `A40DA80A59D170CAA950CF15C18C454D47A39B26989D8B640ECD745BA71BF5DC`  
    ##
    
    
    ## Termux:Styling App Info
    
    **APP_NAME**: `Termux:Styling`  
    **PACKAGE_NAME**: `com.termux.styling`  
    **VERSION_NAME**: `0.29`  
    **VERSION_CODE**: `29`  
    **TARGET_SDK**: `28`  
    **IS_DEBUGGABLE_BUILD**: `false`  
    **APK_RELEASE**: `Unknown`  
    **SIGNING_CERTIFICATE_SHA256_DIGEST**: `A40DA80A59D170CAA950CF15C18C454D47A39B26989D8B640ECD745BA71BF5DC`  
    ##
    
    
    ## Termux:Widget App Info
    
    **APP_NAME**: `Termux:Widget`  
    **PACKAGE_NAME**: `com.termux.widget`  
    **VERSION_NAME**: `0.12`  
    **VERSION_CODE**: `12`  
    **TARGET_SDK**: `28`  
    **IS_DEBUGGABLE_BUILD**: `false`  
    **APK_RELEASE**: `Unknown`  
    **SIGNING_CERTIFICATE_SHA256_DIGEST**: `A40DA80A59D170CAA950CF15C18C454D47A39B26989D8B640ECD745BA71BF5DC`  
    ##
    
    
    ## Device Info
    
    ### Software
    
    **OS_VERSION**: `4.19.113-perf-g18f438a3f5fe`  
    **SDK_INT**: `30`  
    **RELEASE**: `11`  
    **ID**: `RKQ1.200826.002`  
    **DISPLAY**: `RKQ1.200826.002 test-keys`  
    **INCREMENTAL**: `V12.5.7.0.RJSCNXM`  
    **SECURITY_PATCH**: `2022-01-01`  
    **IS_DEBUGGABLE**: `0`  
    **IS_TREBLE_ENABLED**: `true`  
    **TYPE**: `user`  
    **TAGS**: `release-keys`  
    
    ### Hardware
    
    **MANUFACTURER**: `Xiaomi`  
    **BRAND**: `Redmi`  
    **MODEL**: `M2007J17C`  
    **PRODUCT**: `gauguinpro`  
    **BOARD**: `gauguinpro`  
    **HARDWARE**: `qcom`  
    **DEVICE**: `gauguinpro`  
    **SUPPORTED_ABIS**: `arm64-v8a, armeabi-v7a, armeabi`  
    ##
    
    
    Reviewed by zixijian at 2022-03-25 01:59
  • 2. how to install for f-droid version of Termux???

    I installed Termux from F-droid but F-droid build Termux it self then i can't install Termux-GUI from F-droid and Github can you make a release for f-droid???

    Reviewed by dontknowhy at 2022-05-01 13:31
  • 3. demo test3.py cannot display image

    [~]$ python test3.py 1.png
    Traceback (most recent call last):
      File "/data/data/com.termux/files/home/test3.py", line 11, in <module>
        with open("icon.png","rb") as f:
    FileNotFoundError: [Errno 2] No such file or directory: 'icon.png'
    

    delete line 11

    [~]$ python test3.py 1.png
    /data/data/com.termux/files/usr/bin/sh: 1: identify: not found
    Traceback (most recent call last):
      File "/data/data/com.termux/files/home/test3.py", line 50, in <module>
        sock.bind("\0test")
    OSError: [Errno 98] Address already in use
    
    Reviewed by zixijian at 2022-04-09 02:10
  • 4. "App not installed " issue on Android 11 ( redmi note 10 )

    Kindly Solve this issue and give update

    image

    • when i download and installed from F-Droid website
    • i tried uninstall Termux and Termux:API and install Termux:GUI, then it installed without any error .
    • Solve this problem and please give a update for this issue .
    Reviewed by sdp4377 at 2022-03-20 11:45
  • 5. [question]How to integrate SDL2

    It's not an issue just asking for help, because I haven't studied your project in depth yet

    I wonder if it is possible to support SDL2 with c/c++, I have seen someone using termux-gui and ffplay.py to play video.

    Reviewed by Lzhiyong at 2022-03-02 02:55
  • 6. Questions regarding this project

    Hi, I have some questions regarding this project.

    1. Using Rust, I want to make a GUI application using either conrod or iced GUI library. Is it easily portable to termux-gui?
    2. Do I have to compile it for Android ARM processor? Or what would I do to compile it?
    3. Is it possible to have like some sort of a shortcut to my launcher for the GUI Linux application that will automatically launch it as soon as I press it?
    4. If I have scrollable content that can be scrolled only using the mouse wheel on Linux, then if I run it on Android (through termux-gui) would I be able to scroll using the touch screen?
    5. Am I expecting things to be difficult to configure, and have a lot of breakage?
    Reviewed by Raj2032 at 2021-12-25 08:26
  • 7. App can not be installed. Honor 9X

    I have honor 9X and I wanted to try this app but it is not installing. This is probably something to do with architecture.

    (Translation: "Aplikaci nelze nainstalovat" is "Application can not be installed" ) Screenshot_20211127_161239_com google android packageinstaller

    Reviewed by mobilex1122 at 2021-11-27 15:16
Related tags
Wireguard-android - Android GUI for WireGuard

Android GUI for WireGuard Download from the Play Store This is an Android GUI fo

Jan 28, 2022
Android developer tool to draw overlay layout for GUI debug

LayoutOverlay Overview Make a overlay window to show transparent shape to compare size with view, margin. Features Overlay window Drag Drag and drop t

Oct 11, 2021
Linux GUI for Kuri's userspace tablet drivers. Supports non-wacom (XP-Pen, Huion, Gaomon) graphics tablets and pen displays

Kuri's Userspace tablet driver utility (GUI) This is a new GUI implementation for the userland driver I've written here: https://github.com/kurikaesu/

May 13, 2022
A framework for building native applications using React

React Native Learn once, write anywhere: Build mobile apps with React. Getting Started 路 Learn the Basics 路 Showcase 路 Contribute 路 Community 路 Suppor

May 17, 2022
馃摬馃挰 react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in android and iOS devices.
馃摬馃挰 react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in android and iOS devices.

React Native Fontext react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in androi

Dec 3, 2021
A Python native extension written in Kotlin Native

Kotlin Python Ext This is a proof of concept for a Python extension in Kotlin. It is recommended to read the Official Python C API Documentation befor

May 4, 2022
Native-loader - Safely load native libraries in Java

Native Loader ??锔 Safe native loading in Java based off of the native-loader use

Jan 5, 2022
React-native-user-interface - Change React Native userinterface at runtime

react-native-user-interface change RN userinterface at runtime. Installation npm

Jan 11, 2022
馃洅A Minimal Expense E-Commerce App built to demonstrate the use of modern android architecture components [Navigation, Room, MotionLayout, etc..] with MVVM Architecture. 鉁
馃洅A Minimal Expense E-Commerce App built to demonstrate the use of modern android architecture components [Navigation, Room, MotionLayout, etc..] with MVVM Architecture. 鉁

E-Store A Simple E-Commerce App ?? built to demonstrate the use of modern android architecture component with MVVM Architecture ?? . Made with love 鉂わ笍

Apr 28, 2022
Android Study Jams - These are applications built for Android Study Jams 2022 at Chitkara University
Android Study Jams - These are applications built for Android Study Jams 2022 at Chitkara University

Project Description These are applications built for Android Study Jams 2022 at

Jan 9, 2022
Examples of Android applications

Android Demos This is a collection of basic android examples created by Novoda. CarouselFragment CompassExample ContactSelector CustomActivityTransiti

May 23, 2022
An open source application to make your own android applications without coding!
An open source application to make your own android applications without coding!

Stif An Open source project for building Android Application at a go both with and without coding. This project was inspired from Scratch and Sketchwa

Aug 28, 2021
Android Kotlin Completed Training Applications.
 Android Kotlin Completed Training Applications.

Android Kotlin Completed Training Applications. This Repo is used to track a series of Android Kotlin apps I've created based on Google & Udacity trai

Dec 4, 2021
The application is a PoC that helps in identifying modern bankers, potentially malicious and remote controlling applications abusing Android AccessibilityService.

Motivation Project aims to help in: identifying keyloggers and events hijacking malicious applications such as Anubis/TeaBot, identifying a "fake bank

Apr 25, 2022
Changelog - a android library, it helps developers display the history of changes in their applications
Changelog - a android library, it helps developers display the history of changes in their applications

Changelog is a android library, it helps developers display the history of changes in their applications. Supports Locales, Layout direction

Apr 2, 2022
:movie_camera: Movie discovery app showcasing Android best practices with Google's recommended architecture: MVVM + Repository + Offline support + Android Architecture Components + Paging library & Retrofit2.
:movie_camera: Movie discovery app showcasing Android best practices with Google's recommended architecture: MVVM + Repository + Offline support + Android Architecture Components + Paging library & Retrofit2.

Popular Movies Stage 1 + Stage 2 Discover the most popular and top rated movies playing. Movies data fetched using themoviedb.org API. 鉁 Screenshots M

May 14, 2022
Movie Android App written in Kotlin, MVVM, RxJava, Coroutine (Upcoming), Android Architecture Components and Jetpack Compose (Upcoming).
Movie Android App written in Kotlin, MVVM, RxJava, Coroutine (Upcoming), Android Architecture Components and Jetpack Compose (Upcoming).

MovieHunt MovieHunt is a sample Android project using The Movie DB API based on MVVM architecture. It showcases the latest Android tech stacks with we

May 12, 2022
Android News App built in kotlin with implementation of MVVM architecture, android navigation components and retrofit. Displays news to users allowing them to share and save news.
Android News App built in kotlin with implementation of MVVM architecture, android navigation components and retrofit. Displays news to users allowing them to share and save news.

News-App Android news app built in kotlin that fetches news data from news api with Retrofit and displays news to users. This App follow MVVM architec

Apr 21, 2022