File: android-deltas-sync/_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 * * [1.2] All shims now background wakelock acquire/release * calls, to avoid ~10-second pauses on some phones. * * [1.2] _config-widget.sh here now creates widget folders * automatically; _install-shims.sh now installs widget-shim * scripts automatically; and icons/_install*.sh now install * widget icons automatically. See these files for more details. * * Combined, widget setup is now generally just: * * $ cd /sdcard/Download/android-deltas-sync/_etc/termux-widget-shims * $ bash _config-widget.sh * $ bash _install-shims.sh * $ bash icons/_install-icons-alts.sh * * Or simply: * * $ cd /sdcard/Download/android-deltas-sync/_etc/termux-widget-shims * $ bash _INSTALL-ALL.sh * * Which runs a master script that runs the other three. * * [1.1] The file _TERMUX-WIDGET-HOWTO.txt in this folder is * a comprehensive guide to installing and configuring Termux * and Termux:Widget. Please consult it too for more info. ************************************************************ USAGE First, install and setup the Termux widget, per https://wiki.termux.com/wiki/Termux:Widget 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. Note: you must edit each shim's "runee" setting if you didn't unzip this package to /sdcard/Download; change to use your path. COPIES These scripts must be copied in Termux, because the target folder is in app-private storage which is not accessible to file-explorer apps (sans a few explorers that provide limited access via SAF: _README.html#termux-app-private-SAF). Example copy commands - edit install path A if needed, and copy/paste into Termux's console: $ A=/sdcard/Download/android-deltas-sync $ cp $A/_etc/termux-widget-shims/initial-copy.py ~/.shortcuts $ cp $A/_etc/termux-widget-shims/sync-changes.py ~/.shortcuts $ cp $A/_etc/termux-widget-shims/verify-phone.py ~/.shortcuts $ cp $A/_etc/termux-widget-shims/export-phone.py ~/.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. [1.2] See "NEW" above for scripts that automate widget setup. WAKELOCK 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. [1.2] Wakelock acquire/release is now backgrounded to avoid pauses.