Add new widget endpoint in webserver

Hi, there currently is an option to create a new trigger on the fly from webserver - would there be an option to create a touchbar widget as well?

I think you already figured out how to do that, correct? (Touch Bar widgets are also just triggers for BTT)

Hmm well to be honest I haven't looked into that since my post - a tip that it's really just a trigger is really handy. I'll add some abstraction to the btt package to allow easy creation of those in the runtime soon, thanks :slight_smile:

By the way - if you pass BTTGestureNotes (which are the "comments" near the actions in other panes then TouchBar related) in the payload, it takes priority over the BTTWidgetName - I'm not sure if that's a desired behavior.

Also - is there a way, that once you create a widget via webserver - it'll be automatically shown on the touchbar? I mean, this is what happens if you add widget manually within BetterTouchTool itself, so perhaps it could happen on the webserver part, too?

By the way, if you use version 1.1.0 of the btt npm package you should be able to do the following:

// you could also create a new widget on the fly, in the runtime!
const newWidget= btt.Widget.create({
  name: 'toucbar widget name',
  mode: 'node',
  // if you use the package on the frontend, you'd need to prive path option manually
  // path: '/Users/Worie/.nvm/versions/node/v9.2.0/bin/node'
  alwaysShow: false,
  script: `console.log('Hello world!')`,
  appearance: {
    iconHeight : 22,
    iconWidth : 22,
    padding : -5,
    freeSpaceAfterButton : 5.000000, 
    buttonColor : "0.000000, 0.000000, 0.000000, 255.000000",
    alternateBackgroundColor : "128.829533, 128.829533, 128.829533, 255.000000"
  },
});

// now you can update it as you did previously
newWidget.update(() => {
  return {
    text: 'updated!',
  };
});

To create a touchbar widget in the JS runtime.