Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*/app_process and multiple shell management #44

Open
RalfWerner opened this issue Jan 9, 2019 · 1 comment
Open

*/app_process and multiple shell management #44

RalfWerner opened this issue Jan 9, 2019 · 1 comment

Comments

@RalfWerner
Copy link

RalfWerner commented Jan 9, 2019

Hey Fredrik Fornwall
I sent you in November an email and did not receive an answer. In the meantime, I received an instruction from xeffyr (thanks) and also extent my own Termux experience. My dialogue with xeffyr mainly refers to x11/xorg, which probably have nothing to do with you - or?!
But I have another problem where you can hopefully help me.

First, what I've done:
the API base functions include xdg-open (termux-open), this calls */bin/am (all scripts) and this at the end execute /app_process. To the mc package belong .config/mc/mc.ext (corrected open by me), which refer to libexec/mc/ext.d/.sh and this at the end to /app_process too.

That worked well until Nov. 2018. Unfortunately, today I get an open problem (nicht geladen=not loaded).
In my issue https://github.com/termux/x11-packages/issues/49 I've explain it to xeffyr without solution. Insite is "The video: https://www.dropbox.com/s/lsyylstr9nsq3ml/Termux_mc.mp4?dl=0 - was created with an older Termux installation" - see from second: 45 to 1:07
To narrow that down, I've created and run a test script (~/t in 1+2. picture):
grafik

The used app (photos/gallery) is chosen "randomly" and the alternative (photos when v=EDIT) could not be used successfully even before Nov.2018. What is wrong? Where can I find a log file?

The next question (3. picture) relates to the management of several bash displays. Is this an API function? Is it possible to edit and change the navigation drawer (white) via a script e.g. in .bashrc or another (here I did it by hand) and how?

@RalfWerner
Copy link
Author

RalfWerner commented Feb 18, 2019

Except for the last question, my items are done ($(echo`realpath $n`|sed 's/^\///')). The v=EDIT error (above) is acceptable because there is an alternative with $api.
In termux/termux-app#978 I have clarified the question and expanded. I also changed the leading-/ error (above) in the ~/t script, added the $api alternative and added the wildcard ($@) processing. Code and execution in the first screenshot. Both Apps can be used. All files (here two) could be viewed if the decision is made in one second and with different Apps or hastily aborted (ABBRECHEN). After terminating the external App, the function returns to termux (but remains open Apps).

In the code in between (3-40) are functions for 1: Usage/Help, 2: $api dialogues (second screenshot with ~/t d c*) and 3: x11 packages (with needed external Apps third screenshot) described.
grafik
In the second screenshot the c* files are at the begin of sheet. I noticed the following behaviour with termux-* scripts and tried to solve with workarounds in ~/t:

Every rotation of the mobile phone leads to termination (solution: loop), as well as the navigation drawer (not solvable in ~/t). The navigation drawer can be used neither in the dialogues (terminates always) nor in the x11 packages. This was my idea to find out through the issues.

The attempt to start external Apps (first screenshot) in the dialog loop failed, because even with timely/fast selection or sleep function, the external App alternates with the dialogue in a second-rhythm (all processes are parallel and independent).

Attempts to use x11 packages (m: mpv, p: magick) instead of external Apps was also only a few cases successful in (as expected). Since there is currently no startx function in termux, the two external apps XSDL/VNC (third screenshot) are to be used as X server.
With ~/t m c* VNC is used, which requires the Xvnc daemon and env DISPLAY=:1 (in my .bashrc). After , only the music from *.mp4 is played. If you quickly switch to the VNC-App, *.jpg and *.mp4 will play one-after-the-other in poor quality without control - then quit. pinch zoom and phone rotation is possible.
With ~/t 48 m c*, XSDL is used, which does not require a sshd daemon (my phone) and sets env DISPLAY=192*48:0. Display like VNC but in better quality and zoom and rotation-without-distortion is not possible.
With ~/t 32 m c* X-server of my PC is used, which presupposes the sshd daemon but has to follow a decoupling of music and video. Again, no control is possible.

I also tested all three cases with p (display in *magick-x) instead of m (mpv-x). Thereby will display *.jpg and with the next **function the next image. For *.mp4, the Termux app is always aborted, except for ~/t 32 p c* (only '~/t' killed), and consequently the VNC->Xvcn connection.

During the test, I had a number of crashes that I could not repeat except the one above.
To narrow down the problem and possibly repeating it, I have summarized small scripts in Termux widget - unfortunately, this has caused further problems:.
The scripts are started without .bashrc. Therefore must env occupied and possibly daemons be started. In the Xvnc case export DISPLAY=:1 and vncserver (above).
grafik
If termux App is open or not, behave differently. I consider here the case "only *.sh of termux-widget" on start screen (above). Then at VNC App the connection to Xvnc is only possible if the daemon was started from the *.sh and when mpv or display is started the connection must be known in the VNC App. I never managed to do that without a sleep 3 in between and hurry up.
At the end of the action, the stop of the Termux app must still be confirmed, even though I worked in the X server - so 4 app changes are needed to complete the simple action (take a picture and watch a video). With task it would only be three, but I do not get a log.

Is there a simpler solution to avoid frequent app changes or parallel processes?
Ps. if you want to retrace that, i can attach the files. script t:

#!/data/data/com.termux/files/usr/bin/bash
typeset -i i=0; api=$PREFIX/libexec/termux-api; p="$@"; act='--user 0 -a android.intent.action'
if [ "$1" = "-h" -o $# = 0 ];then printf '%s\n' "usage t [opt] [url] [file] (in progress)" ''"
 opt s(Share), u(url) by api" " e(EDIT) default VIEW by app" " d dialogs and values by api
 l extract with logcat into file e" " m(mpv) media player p(display) magick pictures a(animate)
 x(xterm) fullscreen c(check.c) test source for X11 interface" " nn with 30,45,32,33 or 48 XSDL
 selected to view on differend devices in my LAN 
 " " api=$api" " app=/system/bin/app_process (am script)" ""; exit

elif [ "$1" = d ];then m=sheet; b="Dialog Test with"; h="--es input_hint"
a=exit,selfie,speech,confirm,sheet,checkbox,radio,spinner,date,time,counter
t=f=""; test $# -gt 1 && a=`echo $p,$a|cut -c3-|sed 's/ /,/g'`
while [ "$f" = "" ]; do c="--es input_values $a"
case $m in exit) break;; spinner) t="Select next:";; 
 plane) t="plane on"; am broadcast $act.AIRPLANE_MODE --ez state true;c=$h; m=text;;
 selfie) f=tmp.jpg; $api CameraPhoto --es camera 1 --es file `realpath $f`;break ;;
 counter) c="--eia input_range 1,3,2";; date) t=;; time) c=;; text) c="--ez multiple_lines 2 $h";;
 confirm) c=$h; t="Yes sheet or exit";; speech) c=$h; t="say something and I repeat";; esac
d=`$api Dialog --es input_method $m --es input_title "$b $m" $c "$t"`
c=$m; t=`echo $d|cut -d, -f2|cut -c10-`;#echo b=$b, m=$m, t=$t
if [ "$t" = "" ];then t=rotated; elif [ $m = counter ];then m=text
 elif [ $m = date ];then m=time; elif [ $m = time ];then m=counter;t="`date`"
 elif [ $m = speech ];then m=text; echo $t|$api TextToSpeech
 elif [ $m = confirm ];then m=sheet; test `echo $d|grep -c no` = 1 && break
 elif [ $m = text ];then m=spinner; test `echo $d|grep -c ": -2"` = 1 && break
 elif [ `echo $d|grep -c error` = 1 ];then m=text;t=`echo $d|cut -d, -f4|cut -c10-`
 else t=; for n in `echo $a|sed s/,/\ /g`; do if [ `echo $d|grep -c $n` = 1 ]
  then m=$n; if [ `echo $m|grep -c '\.'` = 1 ];then f2="$f $n";
  $api Share --es file $(echo `realpath $n`|sed 's/^\///'); sleep 0;m=$c;fi;fi; done; fi
done ; p="$f"; fi
if [ `echo _30_32_33_45_48|grep -c _$1` = 0 ];then i=3; x=$1
 else export DISPLAY=192.168.178.$1:0; i=6; x=$2; test "$2" = "" && x=2; fi

if [ `echo _x_p_a_m_c|grep -c _$x` = 1 ];then
p="`echo $p|cut -c$i-`"; g=1440x720; f="-*-*-bold-r-*--32-*-*-*-*-*-*-*"
if [ $x = x ];then s="xterm -fn $f -geometry 88x22+0-0 -bg "#eeeece" -fg blue"
 elif [ $x = m ];then s="mpv -geometry $g-0+0 -vo x11"
 elif [ $x = p -o $x = a ];then n=`identify $p|cut -d' ' -f3`; s=display
  test $x = a && s=animate; s="$s -resize $g -geometry $g+0+0"
 else s=~/TMP/check.exe; make $s; fi; echo "$DISPLAY ->($x)$s $p"; $s $p

v=VIEW; b=broadcast; c="-n com.termux/com.termux.app.TermuxOpenReceiver"
for n in $p; do i=i+1; f=$n; test -f $n && f=$(echo `realpath $n`|sed 's/^\///')
 if [ $n = l ];then logcat -d>e;grep 'E ' e; ls -l e
 elif [ $n = e ];then v=EDIT; elif [ $n = u ];then b=start; c=""
 elif [ $n = s ];then v=s; elif [ ! -f $n -a "$c" != "" ];then a="$api Torch --ez enabled"
  $a true;echo $n invalid|$api Toast --ez short true --es background red;$a false 
 elif [ $v = s ];then $api Share --es file $f
 else am $b $act.$v $c -d $f; fi
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant