Tray and floating windows

If you pull the tab in photoshop, it will detach from the tray into a floating tray window from one document… Can you tell me if it is possible to manage photoshop tabs in a UXP application?

  1. I need to make a method that can detach a tab from the tray to a floating window.

  2. You will also need to find an unpinned window to attach documents from the shared tray to its tray.

  3. Also a method that could minimize the window.

I suppose managing windows is limited in UXP Plugin, but it’s partially possible.

Detaching a active document window from the tray and minimise a window.

const FLOATWINDOW_COMMAND = 5996;
const MINIMISE_WINDOW_COMMAND = 5932;

    // detaching a window from the tray
    await core.performMenuCommand({ commandID: FLOATWINDOW_COMMAND }); 
    // minimise a window
    await core.performMenuCommand({ commandID: MINIMISE_WINDOW_COMMAND }); 

atttaching a window on the tray, but forcefully, unit all tabs.
I’m not sure would you be satisfied with the result.

const ATTACH_COMMAND = 5931;
const UNITEALLTABS_COMMAND = 5998;

document.getElementById("unite").addEventListener("click", () => {
  core.executeAsModal(async () => {
    // menu -> Window -> arrange -> tile
    await core.performMenuCommand({ commandID: ATTACH_COMMAND }); 
    // menu -> WIndow -> arrange -> Consolidate All to tab
    await core.performMenuCommand({ commandID: UNITEALLTABS_COMMAND }); 
  }, {commandName: "unite window"});
});

Regarding detecting an unpinned window, I have no idea.