MinimServer Forum
Ping Pong between virtual desktops on MacOs - Printable Version

+- MinimServer Forum (https://forum.minimserver.com)
+-- Forum: MinimServer (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Ping Pong between virtual desktops on MacOs (/showthread.php?tid=6577)

Pages: 1 2


Ping Pong between virtual desktops on MacOs - tarnkappe - 07-04-2022 20:51

Hello,

if you open a minimwatch window on one virtual desktop on MacOs (Catalina, MBP2013), keep it open and then switch to another desktop and open a 2nd window on that virtual desktop, the MacOs GUI toggeling swipes between these two desktops continuously. Probably both windows get the focus alternatingly?

E.g. About-Window here and Log-Window there. Or property-window alternatively.

To break out of this loop you best use 3 fingers swiping up to enter the desktop overview.

Regards
Gert


RE: Ping Pong between virtual desktops on MacOs - simoncn - 07-04-2022 22:42

The next update to MinimServer and MinimWatch will have some changes to fix macOS focus issues. This might help with this problem.


RE: Ping Pong between virtual desktops on MacOs - simoncn - 08-04-2022 11:07

I tried doing what you described this with the next update and the problem is still there. It is possible to stop the toggling by swiping up very gently with three fingers. This leaves one of the desktops selected without opening the desktop overview.

I don't think it wil be possible to change MinimWatch and MinimServer to prevent this toggling. Because MinimWatch and MinimServer don't have Dock icons, it isn't possible to set options for assigning them to a desktop. The Java APIs for getting windows to come to the front and receive focus when required work differently on different platforms and after a lot of experimentation I have found a solution that works on macOS (for a single desktop) as well as Windows and Linux. This solution is coming in the next update and will fix problems on macOS with some windows being hidden behind other windows when they are first opened.


RE: Ping Pong between virtual desktops on MacOs - tarnkappe - 09-04-2022 18:45

maybe you first can focus an already open window to switch to this desktop before opening another window?

But it is ok for me as I know to get out of this toggling loop. I only found it to be funny when it happened the first time. And I think some users might panic a little.

Gert


RE: Ping Pong between virtual desktops on MacOs - simoncn - 11-04-2022 09:51

It makes no difference whether or not the focus is on a MinimWatch window in the first desktop. This toggling happens when any MinimWatch window is open in one desktop and another MinimWatch window is opened in another desktop.

The Java API doesn't know anything about macOS desktops, so a Java application cannot control which desktop will be used for a newly opened window. Also, a Java application cannot know whether any currently open window is on the current desktop or on some other desktop.


RE: Ping Pong between virtual desktops on MacOs - tarnkappe - 11-04-2022 16:30

Well, I thought that MacOs automatically will switch to the desktop with the window that is asking for focus. If this is the case, the 2nd minimwatch window will open on the same desktop after this switch. But I do not know in which cases MacOs does such desktop switches and when not.


RE: Ping Pong between virtual desktops on MacOs - simoncn - 11-04-2022 17:54

In my test, I open window 1 on desktop 1. MinimWatch gives window 1 the focus. I then switch to desktop 2 and open window 2. MinimWatch gives window 2 the focus and the toggling starts.


RE: Ping Pong between virtual desktops on MacOs - tarnkappe - 11-04-2022 20:24

yes, this is the way I test this, too. Therefor the idea to let minimwatch focus the first window before opening the second one. Maybe MacOs will switch back to desktop 1 and minimwatch would automatically open the second window on desktop 1, too?


RE: Ping Pong between virtual desktops on MacOs - simoncn - 11-04-2022 21:24

This would not be correct because the user might intentionally focus another application's window after MinimWatch has focused window 1. In this case, MinimWatch should not override the user's action by refocusing window 1 before opening window 2.

Also, because MinimWatch is not able to detect which desktop is active, this incorrect behaviour would also affect the single-desktop case.


RE: Ping Pong between virtual desktops on MacOs - simoncn - 12-04-2022 17:54

I tried your suggestion as an experiment to see whether it would work. The sequence of events is:

1) The user opens window 1 on desktop 1
2) MinimWatch opens window 1 and gives it the focus
3) The user switches to desktop 2
4) The user opens window 2 on desktop 2
5) MinimWatch gives the last window opened (window 1) the focus
6) MinimWatch opens window 2 and gives it the focus

The goal is to make step 6 switch back to desktop 1 and open window 2 on desktop 1 with no toggling. This works if MinimWatch adds a 500ms delay between steps 5 and 6. With a 300ms delay or less, window 2 is opened on desktop 2 with toggling.

Because a Java application can't detect which desktop is selected, this means MinimWatch and MinimServer would need to add a 500ms delay before showing any window, even when there is only a single desktop. I don't think this would be a good trade-off for solving this very rare problem.