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

Question: is running a secondary command when clicking a button with an interval possible? #481

Open
SirFireball3521 opened this issue Dec 6, 2023 · 1 comment

Comments

@SirFireball3521
Copy link

I'd like to set up a block which updates its text every second, but also does something else when clicked. Is this possible? I don't see anything in the documentation, or in the issues (although I might've missed it there). Something like this:

[testblock]
command=./repeatingscript
interval=1
onclick_command=./onclickscript

where repeatingscript would run every second, and onclickscript would run when clicked.

@mquhuy
Copy link

mquhuy commented Feb 20, 2024

This is not supported natively, but you can get away with some script that can be used to trigger both of these scripts. Like this

[testblock]
command=./masterscript.sh
interval=1

masterscript.sh looks like this

if [[ ${BLOCK_BUTTON:-} == 1 ]]; then
  ./onclickscript
else
  ./repeatingscript
fi

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

2 participants