Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Have a widget that shows the output of a command #29

Open
sweenu opened this issue Dec 5, 2018 · 14 comments
Open

Feature request: Have a widget that shows the output of a command #29

sweenu opened this issue Dec 5, 2018 · 14 comments

Comments

@sweenu
Copy link

sweenu commented Dec 5, 2018

I'd love to have the possibility to have widgets that executes a command every x seconds (chosen by user) and displays the output in the widget area!

Anyways, just discovered Termux, it's awesome, great work :)

@PawelSuwinski
Copy link

PawelSuwinski commented Feb 27, 2020

Just use watch for that, for example:

cat << EOT > ~/watch.sh
#!/bin/bash
watch -n "\${0##*_}" "\$(basename \${0%_*})"
EOT
chmod +x ~/watch.sh  

and every symlink to that script appended with '_n' will exec your script (if available in PATH) with name of simlink without ending '_n' in name on every n seconds.

Ex. ln -s ~/watch.sh ~/.shortcuts/my_task.sh_10

will run my_task.sh on every 10sek :).

@zeonin
Copy link

zeonin commented Apr 1, 2020

I think the more important part would be having the widget output be more dynamic. TBH, it would be very useful to have something like termux-dialog that could output to an Android widget that would also allow callbacks to a script or something.

Maybe even make it a bit like dmenu:

ls * | termux-widget <widget_number> | command here

or have a configuration dialog for termux-widget prompting for a script to run to generate widget entries and another script to run when one is selected.

@bitcoinmeetups
Copy link

Mm. I second this. This would be very useful. I guess Google corporate policy does not allow keyboard input for widgets. But being able to have the output of running scripts in a real widget would also be so useful.

@ghost
Copy link

ghost commented Nov 28, 2020

I guess Google corporate policy does not allow keyboard input for widgets.

I guess SDK does not implement this. Widgets are basically just a clickable picture (complex layouts are also possible, but interaction is limited anyway) on the launcher screen. It also has limits on content update period.

@RalfWerner
Copy link

RalfWerner commented Nov 28, 2020

@bitcoinmeetups in 39 is an example that changes the widget tables (unfortunately only with reload).
On some devices, Termux as a PiP without float is no problem Examples

@tathastu871
Copy link

tathastu871 commented Mar 16, 2023

Maybe a resizable pop up supportint graphical display of output
-> using scripts in .tasks folder
-> widget to run script in background
-> when cliked on widget again if script is already running then display popup showing live output or error
-> if script not already running then run it normally
(maybe live output directlt or from logged file using tail -n1)

Same as above but instead of widget
using dynamic shortcut feature of termux

eg i have curl/wget script. script is written such yhat everythimg is silenced only the progress bar is shown in stdout.
want to run script in background via wifget and keep checkimg stdout for progress bar

Check: https://play.google.com/store/apps/details?id=com.binarysmith.webclipwidget.ad

make two widgets
1-> to run script
2-> to display live text
using id of 2nd we send text to it
and using activity manager execute scheduled refresh of 2nd widget so kind of live update is displayed

Any help with such kind of setup

@gardockt
Copy link

gardockt commented Oct 8, 2023

Termux offers a way to create widgets through Termux:GUI app - sadly, it cannot be installed as of now.

To overcome this issue, I created my own widget that displays output of a command, refreshing itself every 15 minutes. Admittedly, it is quite limited, but works well for basic use cases - I've been successfully using it for a while, and I hope that other people find it useful as well.

@bitcoinmeetups
Copy link

Termux offers a way to create widgets through Termux:GUI app - sadly, it cannot be installed as of now.

To overcome this issue, I created my own widget that displays output of a command, refreshing itself every 15 minutes. Admittedly, it is quite limited, but works well for basic use cases - I've been successfully using it for a while, and I hope that other people find it useful as well.

I want to test it. Can you please add a link to an APK version at the front page of your repo? This maximizes the number of new users.

@gardockt

This comment was marked as off-topic.

@bitcoinmeetups
Copy link

Termux offers a way to create widgets through Termux:GUI app - sadly, it cannot be installed as of now.
To overcome this issue, I created my own widget that displays output of a command, refreshing itself every 15 minutes. Admittedly, it is quite limited, but works well for basic use cases - I've been successfully using it for a while, and I hope that other people find it useful as well.

I want to test it. Can you please add a link to an APK version at the front page of your repo? This maximizes the number of new users.

APK is available in the Releases tab. Thanks for the suggestion though, I may add a link inside README later.

EDIT: At the time of writing this, Codeberg seems to be down, but GitHub mirror is also available: Repository | Releases

Tried to install the app. Widget shows nothing, even though permissions have been enabled. Test command was ping bing.com

@gardockt

This comment was marked as off-topic.

@bitcoinmeetups
Copy link

bitcoinmeetups commented Oct 14, 2023

Tried again using both ping -c 4 reddit.com and echo hello. Unfortunately neither displayed anything. Android 9. Not the latest Termux either.

@gardockt

This comment was marked as off-topic.

@ghost
Copy link

ghost commented Aug 14, 2024

Termux:API has now termux-job-scheduler. I'm outputing job results into the text files. Having an widget to display configured file path(s) content would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants