matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com
MIT License
17.55k stars 643 forks source link

xbar version environment variable #753

Open fenhl opened 3 years ago

fenhl commented 3 years ago

I would like to write plugins that are compatible with xbar as well as the old BitBar app and the alternative implementation SwiftBar. As such it would be nice to have an environment variable to be able to identify the app running the plugin as xbar, ideally with version info, e.g. XBAR_VERSION=x.y.z. That way I would be able to make full use of the features available in the given implementation and version, with graceful fallbacks for unsupported features.

matryer commented 3 years ago

@fenhl I'd support this, do you fancy doing a PR?

fenhl commented 3 years ago

I don't know enough about Go or the project structure, sorry.

thenktor commented 4 weeks ago

Hi, I'm trying to write a plugin, that needs to know whether it is run by xbar or SwiftBar. SwiftBar offers environment variables like SWIFTBAR="1" and SWIFTBAR_VERSION="x.y.z". Would be nice to have at least those two as XBAR and XBAR_VERSION, too. See https://github.com/swiftbar/SwiftBar?tab=readme-ov-file#environment-variables