MacOS Designer Window Focus

Not 100% positive if this is a MacOS issue with the designer, or happens on windows too.

However in my project scan module, I have found that when the dialog box gets opened, it will open on whatever desktop/monitor your mouse is currently focused on in that moment. Not necessarily on the same desktop/monitor as the designer itself.

What this means if if I trigger it via a rest endpoint from Desktop A, and the Designer is on Desktop B. Because my focus was on A, the dialog ends up showing up behind the thing I was interacting with, on Desktop A. Instead of in front of the Designer on Desktop B.

This is fairly annoying, as ideally I just want that popup to always show up straight in front of the designer.

Is there something I can do here to try to identify the dialog gets opened on the specific desktop as the designer?

In the repository, see ignition-project-scan-endpoint/designer/src/main/java/com/bwdesigngroup/ignition/project_scan/designer/dialog/ConfirmationDialog.java at 324d8252cf3aafe69abe1993b0abe0778d55183c · design-group/ignition-project-scan-endpoint · GitHub for the specific class being triggered. This is from a push notification being sent from the gateway to the designer.

I have attempted to center the popup on the owner (the designer), but that just ends up centering it on whatever desktop It ends up on.

private void centerOnOwner(Frame owner) {
    if (owner != null) {
        GraphicsConfiguration gc = owner.getGraphicsConfiguration();
        Rectangle screenBounds = gc.getBounds();
        Rectangle ownerBounds = owner.getBounds();
        
        Dimension dialogSize = getSize();
        
        int x = ownerBounds.x + (ownerBounds.width - dialogSize.width) / 2;
        int y = ownerBounds.y + (ownerBounds.height - dialogSize.height) / 2;
        
        // Ensure dialog stays within screen bounds
        x = Math.max(screenBounds.x, Math.min(x, screenBounds.x + screenBounds.width - dialogSize.width));
        y = Math.max(screenBounds.y, Math.min(y, screenBounds.y + screenBounds.height - dialogSize.height));
        
        setLocation(x, y);
    }
}

Does
com.inductiveautomation.ignition.designer.gui.CommonUI#centerComponent(java.awt.Component, java.awt.Component) work for you?

It seems to center it on whatever main-monitor desktop is open in that moment.

So if I move the "trigger" to a second display, it always shows up on what the laptop is considering the "Main" monitor. If I put the trigger on the "main monitor" and the designer on a second "Desktop" then it shows up on top of the trigger, because it was the current main monitor display in that moment.

To be clear in my wording, when I say Desktop I mean the MacOS concept of multiple desktops

When I am hitting Save on the VS Code instance here, it is opening the dialog window underneath the VS Code instance on "Desktop 4", and not in front of the designer on "Desktop 3"

Ah, yeah. Swing has no concept of OS aggregated desktops, and doesn't give you any way to interrogate that information. You're basically SOL.