Add new option for behavior when window on different desktop is activated
I implemented the issue discussed in #76, in response to bug #438375.
When a window that is on a different virtual desktop than the current one gets activated, the current behavior is that the active virtual desktop will be switched to the one the activated window is on. This may seem reasonable for a scenario where the user explicitly intends to activate an existing window on a different desktop. However, the following scenario is also (perhaps even more?) common: When an application responds to a launch command by requesting to activate an existing instance instead of opening a new one (such as Firefox or KDE System Settings), an existing window on any desktop will get activated even when what the user had in mind was opening a new window (on the desktop they are currently in).
This means that opening an application, such as following a URL or accessing a system setting, unexpectedly results in the user being teleported to a different virtual desktop. This can be very irritating, see e.g.
- https://forum.kde.org/viewtopic.php?f=20&t=87631
- https://forum.manjaro.org/t/stop-switching-workspace-when-opening-same-app-from-different-workspace/59377
- https://www.reddit.com/r/kde/comments/qw75om/firefox_activities/
- https://www.reddit.com/r/kde/comments/raxyb4/kde_activities_cannot_open_2nd_instance_of_chrome/
- https://www.reddit.com/r/kde/comments/swl1fb/15_minute_bug/
The more expected behavior for these users would be to have windows always open on the desktop where they are called from. This is what this MR adds as a new option.
This adds a toggle in the window settings for the behavior of when a window that is on a different desktop than the currently active one gets activated (e.g. by launching an application that already has a running instance and won't open another one):
- "Switch to the other desktop" is the current behavior, and the default: The active desktop will be changed to the one the window is on, the desktop assignment of the window remains unchanged.
- "Bring the window to the current desktop" is the optional new behavior: The currently active desktop remains active, and the window will be sent (in X11: moved; in Wayland: copied) to the current desktop.
I have never contributed before and am also new to the C++ language, so if there are any issues with the code or the submission process, I would greatly appreciate clear pointers on how to improve it.