Events: resize of frame?

We’re attempting to create a robust plugin and unfortunately it appears we don’t have a nice, and automated, mechanism to re-run the plugin when a user completes an action such as resizing a frame object.

What might be some ways to achieve this that don’t involve having the designer re-run the plugin on the selected frame(s) manually?

It would be nice to have the plugin attach an event watcher to an object the plugin has been run on.

Example:

  • Designer creates a new frame
  • Frame is selected
  • Run plugin
  • Plugin does its thing and attaches event to object
  • Designer resizes object, plugin reacts to event

Thanks for your help.

Rather than close the plugin after it’s done, could you just keep it open until the user decides to close it? Then you can monitor changes in selection and/or set up an event watcher.

Unfortunately this is a plugin without a UI. It doesn’t require any input from the user to accomplish the task.

There is no problem in keeping the no-UI plugin open. You can just say something like “waiting for frame selection” in the bottom notification toast. There are no other ways, plugins can’t auto-open or listen to all events (only a limited set of events is available such as selection change, but you can always run a check in setTimeout/setInterval).

1 Like

Unfortunately the designer experience isn’t to run the plugin on any selection but to run it on demand on the selected objects.

Polling also sounds like it would add a fair bit of overhead and oddities to the designer experience.

I was hoping for a mechanism that would attach an action to the object once the plugin ran once on the selection. Sort of tagging an object as a “smart object” and allowing it to act upon itself moving forward.

Nothing like that is possible in Figma. Plugins can only be opened manually by the user.

Can you explain the use-case a bit more, why do you need this? Maybe adding a plugin relaunch button to the right panel would suffice: put it on the necessary objects and the user would be able to launch the plugin to, for example, update that smart object, via the right panel.