Dealing with tabbed applications and virtual desktops
The situation I'm talking about is the following: You have a Firefox window on virtual desktop 1, and another on VD 2. If you focus the one on VD 2, switch to VD 1 and click a link in a different application, Firefox will open that link as a new tab in the window on VD 2, despite a more appropriate window being available.
Currently applications like Firefox can't do anything better, as they don't have any information about virtual desktops, so the last focused window is used instead. Simply exposing that information isn't a good idea though, because it requires defining restrictions on the compositor about what virtual desktops are and how they can be used.
I see two possible alternatives that limit the amount of "leaked" information:
- tell the application if a given window is on a currently visible virtual desktop. This comes with two caveats though:
- it leaves interpreting the user intent up to the application. If no window is on a visible VD, then it could open new tabs in an existing window on another VD, or as a new window
- it's not necessarily about virtual desktops. In a XR environment, it might make sense to prefer windows in front of the user to those that are currently not visible for example
- tell the application whether or not it should prefer a given window for opening new tabs. If no existing window is preferred, it should open a new one.
- if a user always wants existing windows to be used regardless of the virtual desktop, the compositor can relay that information to the app by marking all windows as preferred
The second option seems like the best and most straight forward thing to do. Are there any problems with that, or better options I'm overlooking?