> For the complete documentation index, see [llms.txt](https://docs.udroid.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.udroid.org/udroid-landing/setting-up-gui/termux-x11.md).

# setting up termux-x11

Termux:X11 is the official Termux X server add-on for Android. It is a fully fledged X server and consists of two parts: the Termux:X11 Android app and its companion Termux package.

This guide covers the official [termux/termux-x11](https://github.com/termux/termux-x11) project used with a uDroid distribution.

### 1. How does it work?

The companion package starts the Termux:X11 server and creates the X11 socket. Linux graphical applications connect to that socket using the display address in the `DISPLAY` environment variable. The Android app displays the X server's output and handles Android-side input.

### 2. Requirements

* Termux from [f-droid](https://f-droid.org/en/packages/com.termux/) or [termux-dev builds](https://github.com/termux/termux-app/actions/workflows/debug_build.yml)
* termux-x11 app from [GitHub releases page](https://github.com/termux/termux-x11/releases) \*

  ```
  <figure><img src="../../.gitbook/assets/image.png" alt=""><figcaption></figcaption></figure>
  ```

### 3. Setup Instructions

First, we need to set `x11-repo` and then to install `termux-x11-nightly`. These commands below do the job of installing both of them. execute these commands in termux-app ( copy, paste, then enter )

```bash
apt install x11-repo -y
apt install termux-x11-nightly -y
```

### 4. Starting `termux-x11` app

Start the termux-x11 app and use this command in termux to start the x11 server

```bash
termux-x11 :0 &
```

{% hint style="info" %}
`:0` is the display number and `&` is used to stop termux-x11 from locking the terminal
{% endhint %}

### 5. Using termux-x11 with UDROID

udorid launch script takes care of mounting the termux-x11 default socket directory to the suites tmp directory, you just have to export the **DISPLAY** variable to the correct display address and run the application/Desktop environment to show the GUI in termux-x11

Login to your distro and try out these examples

### Examples

#### Staring `glxgears`

```bash
export DISPLAY=:0
glxgears
```

#### Staring `xfce4`

```bash
export DISPLAY=:0
startxfce4
```

{% hint style="info" %}
If XFCE starts but moving windows, opening menus, or scrolling feels slow, disable its compositor. See [Smooth Termux:X11 desktop performance](/udroid-landing/setting-up-gui/smooth-desktop-performance.md) for the quick fix, touch-friendly scaling, and the reason this helps on Android.
{% endhint %}

#### Staring `gnome`

```bash
export DISPLAY=:0
export XDG_CURRENT_DIR=GNOME

# PATH GNOME issue with proot
for file in $(find /usr -type f -iname "*login1*"); do mv -v $file "$file.back"; done

service dbus start
gnome-shell --x11
```

{% hint style="info" %}
Sometimes you may need further tweaks to make program run termux-x11

it may be options, environment variables and etc...
{% endhint %}

### termux-x11 repo

{% embed url="<https://github.com/termux/termux-x11>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.udroid.org/udroid-landing/setting-up-gui/termux-x11.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
