How To Use Termux X11

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Ivon’s Blog 🇬🇧

How to use Termux X11 - The X


server on Android phone
🇹🇼 中文版
Termux X11 is a Termux Add-On app which allow you to run X server on
Android phones. What does this mean? First of all, it can be used to run Linux
desktop programs under the X11 protocol, and the graphical performance is
better than VNC server. In addition, Termux X11 supports OpenGL partially and
can also achieve 3D hardware acceleration through the experimental VirGL
server (virglrenderer).

Termux X11 can be used with mouse and keyboard, or with touching gestures.
Just setting the appropriate desktop resolution so you could interact with the
desktop environment using your phone’s keyboard.
Ivon’s Blog 🇬🇧

1. Install Termux X11


Termux X11 is still in alpha stage.

1. Install Termux

2. Login to your Github account. Download latest APK from Termux-x11


Github workflows. Download the Termux X11 APK (Branch: master)
Ivon’s Blog 🇬🇧

3. Unzip the archives and install Termux-x11 apk.

4. Launch Termux, instal x11-repo. Then install termux-x11-nightly

pkg update
pkg install x11-repo
pkg install termux-x11-nightly

2. Usage 1: Run X11 apps in Termux


Personally, I recommended you to use Termux X11 with proot-distro because
Termux has fewer package than proot-distros.

Here I only briefly test XFCE4, GIMP, and Firefox.

1. Open Termux X11 APP and you will see this


Ivon’s Blog 🇬🇧

2. Go back to Termux. Install XFCE4 and GIMP

pkg install xfce gimp

3. Launch XFCE4 with dbus-launch

termux-x11 :0 -xstartup "dbus-launch --exit-with-session xfce4-session"

If you encounter Make sure an X server isn't already running(EE) error, close
Termux, then “Force stop” and “Clear cache” Termux and Termux X11 in
Android system settings.

4. Now you should see XFCE4 runnning in Termux X11.


5. You could change Touchscreen input mode in Termux X11 preferences in
Ivon’s Blog
notification bar.
🇬🇧

6. If the font is too big, open System settings → Appearance → check Cutsom
DPI 。
7. Press CTRL+Z in Termux to stop XFCE4.

3. Usage 2: Run X11 apps in Proot-distro


1. Install a proot-distro. For example Debian or Arch Linux.

2. Open Termux X11 app. Then go back to Termux.

3. Login to proot-distro as a normal user with --shared-tmp .

proot-distro login --user user debain --shared-tmp

4. Add user to video and audio groups:

sudo usermod -aG video,audio $USER

5. Launch desktop environment. For example, XFCE4


Ivon’s termux-x11
Blog :0 -xstartup "dbus-launch --exit-with-session xfce4-session" 🇬🇧
6. While in Termux X11, you can activate phone keyboard by pressing back
button. I suggest you to install Hacker’s Keyboard for using desktop
shortcuts.

7. Proot-distro have more packages than Termux. For an instance, it is


possible to play Minecraft with MultiMC.

手機玩Java版Minecraft 1.18 (MultiMC in Android Termux Proot)

4. Usage 3: Run X11 apps in chroot


Root permission is required.

1. Setup chroot Ubuntu

2. Launch Termux X11 APP

3. Go back to Termux, start Termux X11

XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :0 -ac &

4. Mount Termux’s tmp to Ubunut’s tmp


Ivon’s sudo
Blog busybox mount --bind $PREFIX/tmp /data/local/tmp/ubuntu/tmp 🇬🇧
5. Log into chroot Ubuntu

sh /data/local/tmp/startu.sh

6. Start XFCE4

sudo chmod -R 777 /tmp


export DISPLAY=:0 PULSE_SERVER=tcp:127.0.0.1:4713
dbus-launch --exit-with-session startxfce4 &

5. Starting Wayland session in Termux


Termux-x11 is a XWayland server. However it is possible to start a nested
Wayland session in it.

Just intall weston and launch it in the terminal:

weston

6. GPU Acceleration in Termux X11


See : virglrenderer: Termux GPU Hardware Acceleration Tutorial
Ivon’s Blog 🇬🇧
Register as a free Liker

qj985n2

No Likes

Related

[Root] Install Ubuntu in How to install Arch Linux


chroot on Android ARM on Android phone
without Linux Deploy (Termux Proot-distro)
4 November 2023 25 July 2023
Smartphone Termux tutorial Linux Smartphone Termux tutorial
Android Ubuntu Termux Arch Linux Termux

A simple Termux tutorial


for beginners
23 July 2023
Smartphone
Ivon’s Blog
Termux tutorial Termux
🇬🇧

You might also like