swiftbar / SwiftBar

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

SwiftBar runs apps from the user's home folder, BitBar and xBar default to the scripts folder. #378

Closed sirgatez closed 1 year ago

sirgatez commented 1 year ago

Describe the bug SwiftBar runs apps from the user's home folder, BitBar and xBar default to the scripts folder.

This causes a problem for any app which accesses any file which may co-exist alongside the executable script. I have a few scripts which keep configuration in a file which accompanies the script itself.

To Reproduce Steps to reproduce the behavior: From SwiftBar select "Run in terminal" and it will drop you into your home folder. Scripts looking for files will not find them.

Expected behavior The script should be executed from the script's folder to be backwards compatible with BitBar/xBar.

Screenshots N/A

Environment:

Plugin Example: Applies to all plugins.

Additional Context:

melonamin commented 1 year ago

I actually didn't know that xbar runs the plugin within the context of a plugin folder. Do you know what happens if you have subfolders?

In SwiftBar there are a couple env var that maybe useful to you:

Overall I think using these variables(and equivalent in xbar) is more appropriate than assume the running path.