swiftbar / SwiftBar

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

Unable to disable plugins just by renaming to .off #239

Closed mlcampbe closed 2 years ago

mlcampbe commented 3 years ago

With the v1.3.0 release I could enable/disable a plugin by simply renaming the shell script. For example:

mv script.15s.sh script.15s.sh.off would disable it and going the other way would enable it.

But now with v1.4.0 that does not seem to be working anymore so I suspect some type of caching going on that I am unaware of. I do notice that in the Library/Application Support/SwiftBar/Plugins folder I have a directory for each of my plugins but that directory is empty.

I can still enable/disable a plugin by using the preferences pane and the checkbox but was really looking to do so from the command line again.

Any ideas why this behavior has changed?

melonamin commented 3 years ago

Hi Mike, are you sure it was working in 1.3.0? I just downloaded it and tested - adding .off doesn't disable the plugin.

Overall even if it worked it's not expected behavior, what happens when you rename a file:

So when you're renaming a file, from SwiftBar perspective you've added a new plugin and removed another one.

To address your need I've added the following URL Scheme path's:

Endpoint Parameter Description Example
enableplugin name plugin name Enable plugin by name swiftbar://enableplugin?name=myplugin
disableplugin name plugin name Disable plugin by name swiftbar://disableplugin?name=myplugin
toggleplugin name plugin name Toggle(enable\disable) plugin by name swiftbar://toggleplugin?name=myplugin

Call it like this open -g "swiftbar://toggle?name=cal"

mlcampbe commented 3 years ago

I am pretty sure that just renaming the file worked in 1.3.0 because I use that method to enable/disable a battery level plugin depending if I am on battery or AC. But, the newly added API calls will be much better in the long run. Thanks for the quick reply.