SwiftBar
SwiftBar copied to clipboard
Add ENV variable containing plugin refresh trigger information
Plugin refresh can be triggered in many ways in SwiftBar, it would be useful to know the trigger during script execution.
@stegmatze can you try this in beta build?
@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 https://github.com/swiftbar/SwiftBar/discussions/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!