How to use Termux X11 - The X server on Android phone

๐Ÿ‡น๐Ÿ‡ผ ไธญๆ–‡็‰ˆ

Termux X11 is a Termux add-on app providing Android frontend for X. The performance is better than VNC server. Although it supports touching gestures, it’s better to have your mouse and keyboard connected to the phone.

1. Install Termux X11

Termux X11 is still in alpha stage.

  1. Install Termux

  2. Login to your Github account. Download latest build archives from Termux-x11 Github workflows. Current version: 1.02.07

  3. Unzip the archive and install the apk.

  4. Launch Termux, instal x11-repo, Xvfb:

1
2
3
pkg update
pkg install x11-repo
pkg install xwayland xorg-server-xvfb
  1. Install Termux-x11 deb from sdcard
1
2
termux-setup-storage
dpkg -i storage/shared/Download/termux-x11/termux-x11.deb
  1. Edit ~/.termux/termux.properties with VIM:
1
vim ~/.termux/termux.properties
  1. Uncomment allow-external-apps=yes. Restart Termux.

2. Run X11 apps with Termux

  1. Open Termux X11 APP and you will see this

  2. Start termux-x11 in Termux

1
2
Xvfb :0 -ac &
DISPLAY=:0 termux-x11 &
  1. Install XFCE4 and GIMP
1
pkg install xfce gimp
  1. Launch XFCE4 with dbus-launch
1
2
export DISPLAY=:0
dbus-launch --exit-with-session startxfce4 &
  1. Now you should see XFCE4 runnning in Termux X11.

  2. You could change Touchscreen input mode in Termux X11 preferences in notification bar.

  3. If the font is too big, open System settings โ†’ Appearance โ†’ check Cutsom DPIใ€‚

  4. Press CTRL+Z in Termux to stop XFCE4.

3. Run X11 apps with Proot-distro

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

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

1
2
Xvfb :0 -ac &
DISPLAY=:0 termux-x11 &
  1. Login to proot-distro as a normal user with --shared-tmp.
1
proot-distro login --user user debain --shared-tmp
  1. Add user to video and audio groups:
1
sudo usermod -aG video,audio $USER
  1. Launch desktop environment. For example, KDE Plasma:
1
2
export DISPLAY=:0
dbus-launch --exit-with-session startplasma-x11 &
  1. Now you should see DE running in Termux X11. Go to System settings โ†’ Appearance โ†’ Fonts and check Custom DPIใ€‚

  2. Install onboard package for the floating keyboard.

  1. Proot-distro have more packages than Termux. For an instance, it is possible to play Minecraft with MultiMC.

4. Starting Wayland session in Termux

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

Just intall weston and launch it in the terminal:

1
weston

5. GPU Acceleration

See๏ผšvirglrenderer: Termux GPU Hardware Acceleration Tutorial

If this article is helpful to you please consider supporting me.