-
Notifications
You must be signed in to change notification settings - Fork 100
Description
I've been looking at how home screen widgets work. It seems the normal usage is to update the widget's remote view via a process that is kept running in Termux. The tutorial example uses a while True: loop.
It also looks like the widget's remote view handler sets up an onClickPendingEvent that launches the Termux app. This seem to be handled through the AppWidgetProvider, so it works when the Termux and Termux GUI apps are closed.
Would it work to use the Termux RUN_COMMAND intent to launch a command in Termux to update the remote view of a widget, when that widget is clicked?
This way you could leave Termux and Termux GUI closed but still be able to run some action on user interaction with the widget (like a graphical version of the Termux Shortcuts app) or tap the widget to refresh the view.
Perhaps you could ask the user to provide a command name or path when creating a new widget, or choose a generic widget handler command name for Termux and pass the widget ID as an argument?