matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)

Home Page:https://xbarapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Display some sort of form for user input

glampr opened this issue · comments

It would be nice for some commands, to display a native form of some sort to gather user input for the command that's about to run.

e.g. click on a menu item that runs a command that also accepts a reason/description.

It would be nice to prompt the user with a simple form, that would accept text input from the user and then pass this to the xbar plugin to use it for its operation.

Does this sound like something you might want to support?

That actually sounds pretty cool. Do you want to make a proposal on how that would work?

I was thinking something like:

      -- MyMenuItem1 | shell=ssh | param1=$ENV_PARAM1 | userParam2=text | userParam3=dropdown{opt1,opt2}
      -- MyMenuItem2 | shell=/path/to/script | userParam1=checkbox{mon,tue,wed,...} | userParam2=text | param3=foo | param4=bar

where we could have simple form controls, like text inputs, and dropdown menus, etc..

When the user clicks the MyMenuItem1 or MyMenuItem2, xbar will scan that this command contains userParamX and then display a native modal form to capture user input. Upon form submission xbar will pass the user input to the plugin to resume the intended operation.

Obviously you can get as creative as needed with the form controls. I think this can just have a plain text input to begin with and improve it from there.

What do you think?

Form layout may be tricky, but in principle I like it. Considering we have metadata, have you thought about how that might be used to define a form? Perhaps we could define a form with a name and then use -- MyMenuItem1 | shell=ssh | form=login - just a random thought 👍

That would also work provided you somehow define a mapping as to what form control provides which param for the script.
I think it will be essential to mix and match form and plain parameters.

-- MyMenuItem1 | shell=ssh | param1=foo | formParam2=form.username | form=login

and then you can define the login form in the plugin metadata?