File: android-deltas-scripts/_etc/termux-widget-shims/_README.txt

The scripts here are "shims" for use with Termux:Widget,
which make it easier to run this package on your phone.

These shims are helper scripts, that simply run the main 
phone-side scripts indirectly when a home-screen shortcut 
or widget entry is tapped.  This two-step arrangement:

  - Avoids copying the main scripts to the shortcuts folder
  - Supports main scripts in permission-less shared storage
  - Makes "#!" shebang-line paths moot in the main scripts
  - Keeps the console open at exit without config changes
  - Allows the Termux wakelock to be managed automatically

While command lines also work, these shims are recommended
for launching this system's phone-side scripts.

* NEW 
* The file _TERMUX-WIDGET-HOWTO.txt in this folder provides 
* a comprehensive guide to installing and configuring Termux 
* and Termux:Widget.  Please consult it too for more info.


First, install and setup the Termux widget, per

Then, copy these shims to the ~/.shortcuts folder in Termux
per the next section, and see their top docstrings as well as 
"Launching Scripts" in the usage guide (top-level _README.html) 
for more info.  In short, these shims will show up as entries 
in the home-screen widget's menu, or stand-alone shortcuts; 
tap them there to launch the main scripts they reference.


These scripts must be copied in Termux, because the target 
folder is in app-private storage which is not accessible 
to file-explorer apps.  Example copy commands - edit install
path A if needed, and copy/paste into Termux's console:

  $ A=/sdcard/Download/android-deltas-scripts
  $ cp $A/_etc/termux-widget-shims/ ~/.shortcuts
  $ cp $A/_etc/termux-widget-shims/ ~/.shortcuts
  $ cp $A/_etc/termux-widget-shims/ ~/.shortcuts

You need copy only the shim scripts to the Termux shortcuts
folder this way.  The main scripts (named "runee" in the shims)
should not be copied or moved from their installed location.
It is also not necessary to make the shim scripts executable
with a "chmod" command to use them in the widget.


These shims now automatically acquire and release the Termux
wakelock around main script runs.  This works despite Termux 
not being fully loaded, and the Python coding (os.system) suffices.
Assuming they are supported on your phone, wakelocks ensure that a 
script will continue to run even if the phone's screen blanks.

[Home page] Books Code Blog Python Author Training Search ©M.Lutz