zeroxoneafour / kwin-autotile

Autotile script for kwin
https://store.kde.org/p/2003956
MIT License
43 stars 1 forks source link

Tiling interrupted after moving window between screens with keyboard shortcut #12

Closed willowew closed 1 year ago

willowew commented 1 year ago

Using either Window to Previous screen or Window to Next Screen as a keyboard shortcut, it moves the window to the other screen but doesn't resume tiling on the next screen and instead goes into floating mode. It also leaves the space it previously occupied empty on the previous monitor, where the remaining windows don't expand and fill out the available space. Expected behaviour would be that the window that is changing screen adapt and tile, while the window that don't change screen also adapts and take up the remaining place.

Before After

I have tried to make the panels identical across both monitors as well as making sure that each monitor used the same tiling layout (4 identical rectangles), neither of which had any effect on the issue.

This issue might be similar to #2.

Tested with v1.1.0.

zeroxoneafour commented 1 year ago

This error is expected as I do not have any code in the script for handling two separate screens. The reason for this is that I do not own two separate screens and therefore cannot test the feature.

I can try to come up with something

zeroxoneafour commented 1 year ago

Can you provide a journalctl output as detailed in the faq for switching window screens?

willowew commented 1 year ago

Sure, just opened a few windows and moved them across the screen. The issue above was present.

Mar 25 17:47:20 user kwin_wayland[5291]: js: Autotile DBG: Config Updated Mar 25 17:47:20 user kwin_wayland[5291]: js: Autotile DBG: useWhitelist == false Mar 25 17:47:20 user kwin_wayland[5291]: js: Autotile DBG: blacklist == krunner,yakuake,kded,polkit Mar 25 17:47:20 user kwin_wayland[5291]: js: Autotile DBG: tilePopups == false Mar 25 17:47:20 user kwin_wayland[5291]: js: Autotile DBG: borders == 3 Mar 25 17:47:20 user kwin_wayland[5291]: js: Autotile DBG: invertInsertion == false Mar 25 17:47:20 user kwin_wayland[5291]: js: Autotile DBG: keepTiledBelow == true Mar 25 17:47:45 user kwin_wayland[5291]: js: Autotile DBG: Tiling client Alacritty Mar 25 17:47:46 user kwin_wayland[5291]: js: Autotile DBG: Tiling client Alacritty Mar 25 17:47:53 user kwin_wayland[5291]: js: Autotile DBG: Removing client Alacritty Mar 25 17:47:55 user kwin_wayland[5291]: js: Autotile DBG: Tiling client Alacritty Mar 25 17:48:02 user kwin_wayland[5291]: js: Autotile DBG: Tiling client Alacritty Mar 25 17:48:03 user kwin_wayland[5291]: js: Autotile DBG: Tiling client Alacritty Mar 25 17:48:03 user kwin_wayland[5291]: js: Autotile DBG: Removing client Alacritty Mar 25 17:48:05 user kwin_wayland[5291]: js: Autotile DBG: Removing client Alacritty

zeroxoneafour commented 1 year ago

It appears that switching screens does not change the virtual desktop and activate its signal. This is actually bad because the screenChanged() signal of the window does not have any arguments. This means that I cannot get the window that changes screen when it happens, because the QObject::sender() method that is needed to get the sender of a signal does not work in Javascript.

I could create a workaround by iterating through the list of clients and checking which ones have changed their screens lately, but this would be much more inefficient and a very hacky workaround for something that should be very easy.

It makes me annoyed how inconsistent and honestly poorly-thought-out KWin's scripting API is.

zeroxoneafour commented 1 year ago

Test the autotile.kwinscript download directly from the GitHub master branch (version should be 1.1.1) and see if it fixes anything up.

willowew commented 1 year ago

Just tested v.1.1.1 and the tiling now works successfully across both screens. It resizes both the window that is moved as well as the window (or windows) that remain. I did encounter a new bug. It wasn't introduced by v.1.1.1 though, as it was still present when I used v.1.1.0. I'll make a new issue for it.

zeroxoneafour commented 1 year ago

Ok, good that this feature works with the update. Closing this issue, once I fix the new issue I'll probably release v1.1.1