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

Add ENV variable containing plugin refresh trigger information #404

Open
melonamin opened this issue Jan 4, 2024 · 2 comments
Open

Add ENV variable containing plugin refresh trigger information #404

melonamin opened this issue Jan 4, 2024 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@melonamin
Copy link
Contributor

Plugin refresh can be triggered in many ways in SwiftBar, it would be useful to know the trigger during script execution.

@melonamin melonamin added the enhancement New feature or request label Jan 4, 2024
@melonamin melonamin added this to the 2.0.1 milestone Jan 4, 2024
@melonamin
Copy link
Contributor Author

@stegmatze can you try this in beta build?

@stegmatze
Copy link

@melonamin that was fast, thanks!

I was able to get it working together with refreshOnOpen=true.
See this example script, executed every second for the time.

#!/bin/bash
#<swiftbar.refreshOnOpen>true</swiftbar.refreshOnOpen>

date +"%H:%M:%S"
echo "---"
if [ "$SWIFTBAR_PLUGIN_REFRESH_REASON" == "MenuOpen" ]
  then
    say "$SWIFTBAR_PLUGIN_REFRESH_REASON"
fi

This also works on the octoprint script mentioned in #403, but adds a ~1.5-second delay until the menu is open.
Understandable, since the script is executed, image converted etc. Was hoping for it to be faster :-)

Overall, a useful addition!

melonamin added a commit that referenced this issue Mar 12, 2024
Signed-off-by: Alex Mazanov <alexandr.mazanov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants