Retrieve plugin UI position?

I realize there are ways through the API to do the following:

But is there a way to get the current position of the plugin UI once it is open?


There is a way to get the UI position – but its more a work around.

This are the steps I did to get the UI position (more or less accurate):

  1. Send a message to Figma triggered by the user in the ui (for me it was a button click)
  2. When the message is received you can retrieve the position of the user by accessing filtering the currentUser out of the list of activeUsers (there you find the position of the viewport, the size of the viewport and the mouse position of the viewport).
  3. Now you have the mouse position when the user triggered the event
  4. Now you can calculate the position. of the UI, because you know the position of the user on the viewport and in you UI (as you have a trigger with mouse position).

I was able to calculate the position of the UI and place an element next to the UI.

1 Like

I’m surprised there’s nothing in figma.viewport to facilitate this.

P.S.: I am trying your method and I notice that I have to first click in the canvas, then click in the window, for the user position to be updated, and I’m wondering if there’s a way to automate this, maybe to forward the pointer event to the canvas?


doesn’t work. :rofl:

P.P.S.: Oh, so the currentUser position is the last position on the canvas, so I need to simulate a canvas click somehow, like if creating and deleting an object set the last mouse user coordinates to the top-left corner of that object, or something like that. Any clue?