nclarius / KWin-window-positioning-scripts

KWin scripts controlling window placement on multi-monitor setups
GNU General Public License v3.0
59 stars 14 forks source link

Question: does your script allow applications to decide... #17

Closed drone1 closed 1 year ago

drone1 commented 2 years ago

Chrome, for example, re-opens windows in the correct desktops/activities, because I've got a Chrome setting and Settings -> Window Management -> Window Behavior -> Allow apps to remember the position of their windows, if they support it checked.

I do not have time to mess with this script yet, so I just wanted to ask: will it override Chrome's window positions when I launch it (after reboot, for example)? I don't want that. :) Only for new windows, after an application has done it's "remembering."

I'm guessing this is beyond the complexity of this script, but if you don't mind letting me know I'd appreciate it. Thanks.

nclarius commented 2 years ago

Unless the script doesn't work at all for Chrome, it will override the screen but keep the position relative to the screen. E.g. if Chrome placed the window on the right half of an inactive/secondary screen, the script will move it to the right half of the active/primary screen. If you don't want this, you can exclude Chrome from the affected applications. There is no way to distinguish between different windows of the same application without editing the script.

If the script does currently not behave as desired, could you please describe in more detail what steps lead to the situation and what is the expected and what is the actual behavior?

drone1 commented 2 years ago

Hey @nclarius, thanks for the quick reply.

You can test the Chromium (or Chrome) feature I'm talking about:, Go to Settings -> Startup and enable Continue where you left off. Then go into KDE settings as described above.

On first launch of Chromium (after reboot, for example), it will do the expected thing and open all windows/tabs in the last Actitivies & Desktops they were in (before a shutdown, for example).

Now, when I right click Chromium -> Open a new window, it opens the new window in the current desktop. Great. That's what I want, and I do not need your script for that.

But I do want it for something like system settings, which sometimes seems to open in the wrong Activity/Desktop. Or maybe it's just failing to launch?

The root question is: if I run your script and reboot, will all my Chrome windows/tabs suddenly open in my current desktop? :)

nclarius commented 2 years ago

The script does not affect virtual desktops and activities at all, only physical monitors.

nclarius commented 2 years ago

BTW, the same holds for that KDE setting, and also this setting affects only KDE applications.

nclarius commented 2 years ago

As for applications opening on a desktop that is not the currently active one, I changed the code of core KWin and opened a merge request to add an option to system settings to always bring windows to the current desktop, but it is not yet decided whether this feature will be accepted.

For the time being you can use this shell script I wrote as a workaround.

Both the KWin code change and the shell script only address desktops, not activities.

nclarius commented 1 year ago

The "Always open on active virtual desktop" action has since been merged into Plasma btw.

Closing since as far as I can see all questions are answered.