Possible to have a UXP panel load on InDesign startup?

Is it possible to have InDesign automatically show a panel from a UXP plugin, on startup?
Alternatively, is it possible to have a docked panel (opened manually from the Plug-ins menu) persist and reopen (or even show as a docked, collapsed panel) when restarting InDesign?

Thanks in advance :slight_smile:

A bit late to the “party” but I am curious about this as well. It seems like the behavior in PS and ID is quite different in terms of panel visibility persistence. For PS it just works “out of the box”, for ID I have to open the panel manually every time after startup?

I would also like to know this. Been looking all over the place and there doesn’t seem to be a way to do this. It is very inconvenient having users have to go to Plug-Ins > Plugin Panel → Click plugin every single time they start ID. And then it doesn’t remember where they docked the panel or that it is open. Can we get an answer about this? If this behavior doesn’t exist, I think it clearly should.

edit: Or, at the very least, can we have the Plug-Ins panel stay open like most other panels?

Yes, you can do that. I did it in my plugin. Here is a function:

// Open panel by id
const showPluginPanel = function(id) {
    const uxp = require("uxp");
    const plugins = Array.from(uxp.pluginManager.plugins);
    const plugin = plugins.find(
      (plugin) => plugin.id === uxp.entrypoints._pluginInfo.id
    );
    console.log(`Opening panel: '${id}'`);
    if (plugin) { plugin.showPanel(id); }
    else console.error(`Plugin '${id}' found`);
  };

Then, in your main JS logic (e.g., in index.js), you can open the panel like this:

showPluginPanel("main_panel");

Instead of “main_panel”, use the ID of the entrypoint you defined in your manifest.json.

It seems you need the permission enablePluginCommunication for this to work. This is a bit odd because this permission is intended for communication with other plugins, not with your own plugin. However, when I tested it a few months ago, it didn’t work without this permission. Could have been a bug, though.

In your manifest.json, add the following section:

"requiredPermissions": {
    "ipc": {
        "enablePluginCommunication": true
    }
  }

You can find the documentation for this property in the plugin manifest section of the docs:

Hope this helps! :slightly_smiling_face:

I often had troubles with odd permission requirements. E.g. the <sp-link> tag needs launchProcess → schemes permission, although it is a default uxp widget, and this is not noted in the corresponding doc-sections. So if something doesn’t work, check if there could be a permission required. You won’t get any warning in the console, that you’re missing a permission.

Note: This allows you to open a panel at any moment. If you call this function in your main logic, it will open as soon as the plugin loads (for an installed plugin this means right when InDesign starts). But this could be annoying for your users. Especially, as InDesign currently doesn’t save the docked position of plugin panels, or so it seams. Nevertheless, in my plugin this prevented the blank panel bug, so this was the lesser evil.

1 Like

Well… I give you 10 points for a very creative workaround :slight_smile:

But… it is just that, a workaround. The fact that IPC with its special permissions is needed says it all. It is not supposed to be this hard. For CEP plugins this just works “out of the box”, docked and all. If the user left the plugin open, closes InDesign and opens it up again, the panel is there. Same location, same docking, 0 lines of code in the plugin. For UXP nothing is implemented for this it seems which is really frustrating - Please Adobe instead of coming up with fancy new web components, how about implementing/fixing the basics first :frowning:

Thanks :smiley:

For your original question to just open the panel on startup, this seems to be the regular way. Only the permission should not be needed. But I fully on your side, that InDesigns implementation of this is still very buggy.

UXP is rather new, but I would’ve hoped they’d fix some things faster :upside_down_face: