#!/bin/bash # Setup script for X11 Desktop on Termux # This script helps install dependencies and launch the environment. set -e echo "X11 Desktop - Termux Setup Helper" echo "=================================" # Check if running in Termux if [ -z "$TERMUX_VERSION" ]; then echo "Error: This script is intended to run inside Termux on Android." exit 1 fi setup_dependencies() { echo "Updating packages..." pkg update -y echo "Installing X11 repo..." pkg install -y x11-repo echo "Installing dependencies (proot-distro, termux-x11-nightly)..." pkg install -y proot-distro termux-x11-nightly pulseaudio echo "Dependencies installed." } install_debian() { if proot-distro list | grep -q "debian (installed)"; then echo "Debian is already installed." else echo "Installing Debian..." proot-distro install debian fi } launch_session() { echo "Instructions to launch:" echo "1. Open the Termux:X11 app." echo "2. Run the following command to login and start XFCE:" echo "" echo " proot-distro login --user user debian --shared-tmp -- bash -c 'export DISPLAY=:0; dbus-launch --exit-with-session xfce4-session'" echo "" } echo "Select an option:" echo "1) Install Dependencies" echo "2) Install Debian (Proot)" echo "3) Show Launch Instructions" echo "4) Exit" read -p "Choice: " choice case $choice in 1) setup_dependencies ;; 2) install_debian ;; 3) launch_session ;; 4) exit 0 ;; *) echo "Invalid choice." ;; esac