@xx1182, #22990

Closed
opened 2026-01-31 08:29:19 +00:00 by claunia · 0 comments
Owner

Originally created by @inko94 on GitHub (Mar 5, 2025).

@xx1182,
yes you can automate it with alias in your .bashrc or .profile file, but I for myself wrote a small shell script which runs all needed commands for me. It is for me simpler to backup if I need to reinstall Termux or like that.

The shell script looks like:

#!/data/data/com.termux/files/usr/bin/bash

# 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}
termux-x11 :0 >/dev/null &

# Wait a bit until termux-x11 gets started.
sleep 3

# Login in PRoot Environment. Do some initialization for PulseAudio, /tmp directory
# and run xfce as user galaxy.
# 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 debian --shared-tmp -- /bin/bash -c  'export PULSE_SERVER=127.0.0.1 && export XDG_RUNTIME_DIR=${TMPDIR} && su - galaxy -c "env DISPLAY=:0 startxfce4"'

exit 0

Save it as start-xfce.sh for example and make it executable with:

chmod +x start-xfce.sh

As you can see in line 18 of the script, it starts the xfce session as user galaxy. It is because some apps are refusing to start as root user, eg. VLC. So you have first to create a user galaxy or some other name of you wish.
Therefore you have first to log in in your PRoot environment with:

proot-distro login debian

and create a new user

adduser SOME_NICE_NAME in my case: adduser galaxy

the script will ask you for a new password type one, all the other question you can skip.
After you are done, simple log out wit exit

Now you can start the script with ./start-xfce.sh (assuming you are in the same directory where the script is)
or with /path/to/script/start-xfce.sh if the shell script is in a different directory.

I think with Termux:API add-on or at least with Tasker add-on you can even make a starter on your home screen, which will start the script for you, so you even won't see Termux at all. But don't ask me how, never played with this add-ons.

Originally posted by @waldhef in https://github.com/termux/termux-x11/issues/138#issuecomment-1185572872

Originally created by @inko94 on GitHub (Mar 5, 2025). @xx1182, yes you can automate it with alias in your .bashrc or .profile file, but I for myself wrote a small shell script which runs all needed commands for me. It is for me simpler to backup if I need to reinstall Termux or like that. The shell script looks like: ```bash #!/data/data/com.termux/files/usr/bin/bash # 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} termux-x11 :0 >/dev/null & # Wait a bit until termux-x11 gets started. sleep 3 # Login in PRoot Environment. Do some initialization for PulseAudio, /tmp directory # and run xfce as user galaxy. # 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 debian --shared-tmp -- /bin/bash -c 'export PULSE_SERVER=127.0.0.1 && export XDG_RUNTIME_DIR=${TMPDIR} && su - galaxy -c "env DISPLAY=:0 startxfce4"' exit 0 ``` Save it as `start-xfce.sh` for example and make it executable with: `chmod +x start-xfce.sh` As you can see in line 18 of the script, it starts the xfce session as user `galaxy`. It is because some apps are refusing to start as root user, eg. VLC. So you have first to create a user galaxy or some other name of you wish. Therefore you have first to log in in your PRoot environment with: `proot-distro login debian` and create a new user `adduser SOME_NICE_NAME` in my case: `adduser galaxy` the script will ask you for a new password type one, all the other question you can skip. After you are done, simple log out wit `exit` Now you can start the script with `./start-xfce.sh` (assuming you are in the same directory where the script is) or with `/path/to/script/start-xfce.sh` if the shell script is in a different directory. I think with Termux:API add-on or at least with Tasker add-on you can even make a starter on your home screen, which will start the script for you, so you even won't see Termux at all. But don't ask me how, never played with this add-ons. _Originally posted by @waldhef in https://github.com/termux/termux-x11/issues/138#issuecomment-1185572872_
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 08:29:19 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22990