swiftbar / SwiftBar

Powerful macOS menu bar customization tool
https://swiftbar.app
MIT License
2.95k stars 92 forks source link

Can't refresh streamable plugins #281

Closed fenhl closed 2 years ago

fenhl commented 2 years ago

I have a streamable plugin set up to print a fatal error as a menu, then exit. The error menu contains this line:

Refresh | refresh=true

However, clicking it does nothing, and neither does pressing R while it's open (non-streamable plugins are refreshed though) or opening a swiftbar://refreshplugin URL (but see #280). Seemingly the only thing that works to get the plugin to run again is quitting and relaunching SwiftBar. It would be useful if streamable plugins could be refreshed manually, at least if they've exited.

melonamin commented 2 years ago

Refresh is indeed disabled for streaming plugins, in my mind it doesn't make sense...

I expect streaming plugin to run forever, while SwiftBar running. Why this doesn't approach doesn't work in your case? And Why your streaming plugin can "exit"?

fenhl commented 2 years ago

It's true that streaming plugins should run forever, but it's nice to be able to give the user an easy way to just retry if an unexpected error occurs. You could imagine a menu saying “this is probably a bug” and give the option to report it (href to “new issue” page) or just refresh.

In my case, I'm currently working on a streaming plugin for personal use, and it would be nice to simply be able to refresh after I've fixed a bug and compiled a new version.

fenhl commented 2 years ago

I suppose one way to work around refresh being disabled would be for the plugin to keep running and listen for an IPC command, then exec itself.

melonamin commented 2 years ago

How about this, I'll hide\disable Refresh Plugin menu item but allow for URL scheme to work for streaming plugins?

fenhl commented 2 years ago

Sounds good. Allowing refresh=true on a menu item to work as well would make sense too I think.

xilopaint commented 2 years ago

How about this, I'll hide\disable Refresh Plugin menu item but allow for URL scheme to work for streaming plugins?

Sounds good. Allowing refresh=true on a menu item to work as well would make sense too I think.

Why not both? Btw, developing streaming plugins without a refresh feature is a pain.

melonamin commented 2 years ago

I've decided just to enable Refresh for streamable plugins, without caveats 1.4.3 BETA 6