Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Ability to provide input parameters to plugin #160

Closed
bilal-fazlani opened this issue Feb 5, 2021 · 21 comments
Closed
Assignees
Labels
enhancement New feature or request
Projects

Comments

@bilal-fazlani
Copy link
Contributor

Proposal

A plugin developer can publish input parameter requirement in the metadata file (xattr). These parameters can have default values too

Users can then configure plugins by providing (or overriding) input parameters using SwiftBar UI

SwiftBar can provide these input parameters to plugin using environment variables

@melonamin melonamin added the enhancement New feature or request label Feb 7, 2021
@melonamin
Copy link
Contributor

I think we can generalize this to user-defined environment variables.

Plugin developer defines supported env variables, like this:

<swiftbar.environment>['var1':'default value', 'var2':'default value', ... ]</swiftbar.environment>

And than we expose this in Plugin settings for user to override

@bilal-fazlani
Copy link
Contributor Author

bilal-fazlani commented Feb 10, 2021

How about?

<swiftbar.environment>
    <var1>default value</var1>
    <var2>default value</var2>
    <var3></var3>
    <var4 />
</swiftbar.environment>

@melonamin melonamin added this to In Progress in Swiftbar Feb 13, 2021
@melonamin
Copy link
Contributor

I think I'm going to stick with <swiftbar.environment>['var1':'default value', 'var2':'default value', ... ]</swiftbar.environment> at least for now. Much easier parsing with the current code base.

It is live in the beta, you can try it

@melonamin melonamin moved this from In Progress to Done in Swiftbar Feb 13, 2021
@bilal-fazlani
Copy link
Contributor Author

Ok

@melonamin melonamin self-assigned this Feb 13, 2021
@melonamin melonamin added this to the 1.2.3 milestone Feb 13, 2021
@bilal-fazlani

This comment has been minimized.

@bilal-fazlani
Copy link
Contributor Author

plugin file

zoomcontacts.30m.zip

@melonamin
Copy link
Contributor

Please keep it within #167, these are not related

@bilal-fazlani
Copy link
Contributor Author

Apologies.

@bilal-fazlani
Copy link
Contributor Author

I will test this in latest beta today evening

@melonamin
Copy link
Contributor

Hi @bilal-fazlani, did you have a chance to try this one?

@bilal-fazlani
Copy link
Contributor Author

Hey sorry, I got busy during week. Since tomorrow is Saturday, I can test this.

@bilal-fazlani
Copy link
Contributor Author

Still don't see anything in settings

image

# <bitbar.title>Zoom Contacts</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Bilal Fazlani</bitbar.author>
# <bitbar.author.github>bilal-fazlani</bitbar.author.github>
# <bitbar.desc>Shows zoom contacts from a csv file</bitbar.desc>
# <bitbar.abouturl>https://swiftbar4s.bilal-fazlani.com/</bitbar.abouturl>
# <swiftbar.hideAbout>false</swiftbar.hideAbout>
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
# <swiftbar.hideLastUpdated>false</swiftbar.hideLastUpdated>
# <swiftbar.hideDisablePlugin>false</swiftbar.hideDisablePlugin>
# <swiftbar.hideSwiftBar>true</swiftbar.hideSwiftBar>
# <swiftbar.runInBash>false</swiftbar.runInBash>
# <swiftbar.environment>['org':'', 'csvFile':'~/Documents/zoom-contacts.csv']</swiftbar.environment>

zoomcontacts.5s.bin.zip

@melonamin
Copy link
Contributor

Ah, sorry, nothing in UI at this point, only metadata support and internal logic.

I’m adding the UI in the next build

@bilal-fazlani
Copy link
Contributor Author

Ok 👍 . I can test that once it is available.

@bjinse
Copy link
Contributor

bjinse commented Feb 25, 2021

Can you email me if UI needs translation? Happy to provide any new Dutch translations if needed. Not on Github everyday, so not sure if I would miss a notification of some sorts.

@romansavrulin
Copy link

Hello @melonamin

Are xbar variables supported for backward compatibility with plugin re repo?
Is UI property edit feature available in 1.4.4?

@melonamin
Copy link
Contributor

Hey @romansavrulin,

xbar and bitbar parameters are supported in plugin's metadata, if it is what you mean.

UI edit is working, but probably not the way you expect. Instead of updating values in plugin's source code it puts them into source file metadata(file extended attributes), this feature works only in SwiftBar

@romansavrulin
Copy link

romansavrulin commented Apr 6, 2023

@melonamin I believe it is not working as expected. I've put

# <xbar.var>string(APP_NAME="zoom.us"): Zoom app path inside /Application folder</xbar.var>
into my plugin config and the variable is not shown in the UI section of the plugin. I've tried to restart app/reload plugin, etc. No change. Am I missing something?

image

@melonamin
Copy link
Contributor

Ah, got it, <xbar.var> are not supported.

@romansavrulin
Copy link

Any alternative options?

@melonamin
Copy link
Contributor

No, not at the momen. SwiftBar doesn't support parametrization in the same sense as xbar, yet. I don't like how xbar approaches this, but didn't came up with a better version myself yet.

@melonamin melonamin closed this as not planned Won't fix, can't repro, duplicate, stale Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

4 participants