termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
1.96k stars 301 forks source link

Hi, how to run inside a proot-distro #138

Closed xx1182 closed 2 years ago

xx1182 commented 2 years ago

I usually run termux-x11 then proot-distro login Debian, export the display and xdce4-session and it says, cannot connect to display .

xx1182 commented 2 years ago

@xx1182, run in Termux:

Lalalalalllalalallalala

Thanks it works, but I think it would be good to integrate into TERMUX, of course you can just edit .profile or whatever, but, would be good to pheraps include a termux-x11-proot-setup, which just edits .profile and aliases proot-distro login ... --shared-tmp

Regards

waldhef commented 2 years ago

@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.

waldhef commented 2 years ago

ACCIDENTALLY deleted previously comment:

@xx1182, run in Termux:

export XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :0 >/dev/null &

Then log in in your PRoot environment with:

proot-distro login debian --shared-tmp

and run:

export XDG_RUNTIME_DIR=${TMPDIR} env DISPLAY=:0 startxfce4

There is a HowTo for Ubuntu but you can do the same steps also for Debian: RandomCoderOrg/ubuntu-on-android#152

PS.: if you want sound support, then run also in Termux:

pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1

and in your PRoot environment:

export PULSE_SERVER=127.0.0.1

just before starting the xfce4 session.

twaik commented 2 years ago

Can I close this issue?

waldhef commented 2 years ago

I think yes. Since @xx1182 said:

Thanks it works

so his initially question is answered and this issue can be closed.

xx1182 commented 2 years ago

Well, to be fair: Ah it's all your fault, retard program not working, signal 9, fix it! It's your job!!! (It's not your fault)

Second, as suggested, when termux-x11 :1 , just automatically export display, just for convenience, regards.

twaik commented 2 years ago
  1. You did not post logs.
  2. It is not possible. termux-x11 does not start any session so it can not export variables.
twaik commented 2 years ago

@v8karlo Issues are not the right place to advertise your project.

zairullahdev commented 2 years ago

Close this issue as not planned

OrdinaryEnder commented 2 years ago

Can someone filter this

twaik commented 2 years ago

@zairullahdev

Your phone is retard becuz it using android 12 so if your can't code a big project shut up

Termux organization members may be small and please don't try suing them. it is very unhelpful and they have life as well. Disruptive comments will be deleted

OrdinaryEnder commented 2 years ago

He already delete that so everything ok, can we close this?

twaik commented 2 years ago

I think so. I was waiting for positive response from xx1182 but he reported signal 9 (SIGKILL). I am planning to rewrite a significant part of code to get rid of this and then close 4 or 5 issues as cometed at once.

xx1182 commented 2 years ago

If anyone is interested, some guy just made a Termux plus visuals working on a single app, yeah it's a hack and whatever:

It's called VHEditor... It's not my project, I'm not advertising it, I just think that for the average person(how to hack Instagram account? Any of you know how to unlock iPhone trough termux) is a better alternative.

Of course I was joking, you do it in your free time, I'm not entitled to anything, if it doesn't work I should make it myself and fuck me.

I'm saying this, because maybe you can look in it's source code, as it's a simple VScode editor, and it doesn't sig-9, but I think it's because of termux because it's "an utility app" and android has specific blocks and dicks for specific: "file manager/video player etc".

Regards, again this is just news, suggestion, as I'm not entitled to anything, but just want to contribute. Thanks again! Bye.