Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Tasker has Docked, HDMI Plugged and USB Connected profile States that you can use to start termux and run commands. You can use Termux:Tasker plugin to run termux commands from tasker tasks in a foreground terminal session. Install termux and all its plugins from F-Droid, check here for why. You also need to grant termux Draw Over Apps permission from its App Info in android settings, otherwise commands will just be queued in the "termux notification" until you click it. If you don't want to mess around with creating physical script files, you can use tudo to store your script in a tasker local variable and send it to termux as an argument with the plugin to be executed with tudo, it also has other useful options that may be helpful in automating stuff. tudo can probably also be used to fix your termux-boot issues (which shouldn't happen) with tasker Boot event and termux-tasker.
I don't how the details of how the desktop mode actually works, but it seems it has its own launcher to start apps, so termux app only opening in your phone is likely expected behaviour. You could try Taskerbar app for some additional functionality. If you use mirror mode instead, then the entire android screen will be shown, including termux, you could also use scrcpy for that, of course aspect ratio will be same as the phone.