Skip to content

Instantly share code, notes, and snippets.

@gschanuel
Created October 30, 2025 01:29
Show Gist options
  • Save gschanuel/aabed4d7d2d866525cd30ddc9567d0d1 to your computer and use it in GitHub Desktop.
Save gschanuel/aabed4d7d2d866525cd30ddc9567d0d1 to your computer and use it in GitHub Desktop.
New Script
#!/data/data/com.termux/files/usr/bin/bash
# Kill open X11 processes
kill -9 $(pgrep -f "termux.x11") 2>/dev/null
# Enable PulseAudio over Network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1
# Prepare termux-x11 session
export XDG_RUNTIME_DIR=${TMPDIR}/runtime-$(whoami)
termux-x11 :0 >/dev/null &
# Wait a bit until termux-x11 gets started.
sleep 3
# Launch Termux X11 main activity
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1
# Login in PRoot Environment. Do some initialization for PulseAudio, /tmp directory
# and run KDE as user gschanuel.
# See also: https://github.com/termux/proot-distro
# Argument -- acts as terminator of proot-distro login options processing.
# All arguments behind it would not be treated as options of PRoot Distro.
proot-distro login arch --shared-tmp --user gschanuel -- /bin/bash -c '
eval $(dbus-launch --exit-with-session --sh-syntax)
export TU_DEBUG=noconform
export ZINK_DESCRIPTORS=lazy
export ZINK_DEBUG=compact
export PULSE_SERVER=127.0.0.1
export XDG_RUNTIME_DIR=${TMPDIR}/runtime-$(whoami)
DISPLAY=:0 startplasma-x11
#DISPLAY=:0 dbus-launch startplasma-x11
'
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment