# #!/data/data/com.termux/files/usr/bin/bash # # This will start up an X session with VASSAL running in it. When you # stop the VASSAL application, the X session will automatically end. # This will run whatever X session defined in ~/.vnc/xvassal. Please # see that file for more. xstart=$HOME/.vnc/xvassal oper=start read -n 1 -p "Do want to start? (Y/n) " case x$REPLY in xy|xY|x) oper=start ;; *) oper=stop ;; esac case $oper in start) echo "IMPORTANT: Enable Termux Wake-Lock through its notification" termux-wake-lock if test $? -ne 0 ; then read -n 1 -p "Failed to aquire Wake-lock, exiting" exit 1 fi vncserver \ -xstartup $xstart \ -autokill \ -fg \ :1 & vnc_pid=$! termux-open-url vnc://localhost:5901 wait $vnc_pid termux-wake-unlock ;; stop) echo "Stopping the VNC server" vncserver -clean -kill :1 ;; esac