nclarius / tile-gaps

KWin script to add space around windows touching a screen edge or other window
https://store.kde.org/p/1619642
GNU General Public License v3.0
104 stars 16 forks source link

Windows shrinking #11

Closed Akselmo closed 1 year ago

Akselmo commented 2 years ago

Hi, there's a bug when this script is used in Wayland with two monitors:

If I place two vertically full size windows next to each other, the windows start fighting for space and the rightmost window starts shrinking continuously.

I tried to take a video of it but it happens very randomly.

nclarius commented 2 years ago

This sounds like a graphics platform independent issue which should be fixed since a few versions ago. Which version of the script are you running? (Find out with the info button in the KWin script system settings.)

If you are using the most recent version and the problem persists, I'll need some debug information to figure out where it's going wrong. Unfortunately logging may require some detours to get working on Wayland. Could you please run the following in a terminal:

export QT_LOGGING_RULES='*=false; js=true; kwin_scripting=true'
kwriteconfig5 --file kwinrc --group Script-tilegaps --key debugMode true
kwriteconfig5 --file kwinrc --group Script-tilegaps --key fullDebugMode true
qdbus org.kde.KWin /KWin reconfigure
journalctl -g "tilegaps" -f

Then move some windows around and tell me whether you are getting any output from the journal at all?

Akselmo commented 2 years ago

Unfortunately the journal didn't log anything for me. Also I forgot to completely mention that I have two monitor setup. I drew a quick example what's going on: Screenshot_20220504_194853

The window pointed with red arrow starts resizing indefinitely to the direction of orange arrow. It stops when I disable the script. If I enable the script again, it starts again.

However, if the window is moved around and back to the position with quick-tiling, it stops.

It's like the script is detecting the two small windows on other monitor too close to the big window constantly, so it keeps pushing the window smaller.

nclarius commented 2 years ago

Before we continue, could you please verify that you have the current version (6.15) installed, because a bug like this was found and fixed a few versions back.

If this is still present with the newest version: I think I understand what behavior you're getting, but I can't reproduce it on my own multi-monitor setup, so I'll need to look into the log to figure out exactly what's going on.

Please try the following:

echo 'QT_LOGGING_RULES='js=true; kwin_scripting=true' >> ~/.bash_profile
kwriteconfig5 --file startkderc --group General --key systemdBoot true

Then log out and in again. Now run the journalctl command from the earlier post again and move some windows around; are you getting any output now?

If these changes are causing problems, you can revert them by running the same commands again with false.

nclarius commented 2 years ago

If you do get output from the journal now:

Wait for the bug to occur, then do

journalctl -g "tilegaps:" "--since 5 min ago" --until "2 min ago" > tilegaps.log

(with the appropriate time frame, as narrow as possible).

The log file will contain your computer name and window titles, so make sure these contain no sensitive information.

Then upload the contents of the file here and say which window was affected.

Akselmo commented 2 years ago

Hey, sorry it's been a while. If I have time I try to test this this weekend..

Just wanted to comment that I havent forgotten this :)

Akselmo commented 2 years ago

Welp, sorry it took so long. I managed to get the bug happen, but journal isnt logging anything even after following your directions. I am using the one from this repo, i cloned the repo and used install.sh on main branch. When pressing the info button it says 6.15 version.

Edit: How odd, after installing from the kwin store instead of the install.sh, it seems to work fine.. Will update if I see problems occuring again.

Akselmo commented 2 years ago

After running the tile-gaps for a day or so, I noticed that the bug now only appears when the latte-dock panel i have, goes from floating to not-floating. This gives some space to windows on screen, and I guess the script gets confused by this.

nclarius commented 2 years ago

journal isnt logging anything even after following your directions.

Hm. One more possibility I found which you could try: Open kdebugsettings, and make sure "KWin Scripting" is set to "Full Debug".

After running the tile-gaps for a day or so, I noticed that the bug now only appears when the latte-dock panel i have, goes from floating to not-floating.

This is a useful hypothesis, I'll try to reproduce it.

Akselmo commented 2 years ago

Open kdebugsettings, and make sure "KWin Scripting" is set to "Full Debug".

No dice. :(

This is all I'm getting

journalctl -g "tilegaps" --since=yesterday
-- Boot f6a1040c93ef496eaf552f923ce2fbbe --
-- Boot 6cc38cc1cf2741bda866be0adafde7db --
Jun 15 21:44:06 fedora systemsettings[39389]: unable to delete file  "/home/akseli/.local/share/kwin/scripts/tilegaps" . file does not exist.
-- Boot b99fddd9e74747c29c8295eef83f5f24 --
-- Boot 232997e707724b8581ed0850eed6ba1f --
-- Boot 0a2b53f7521f411aa48f055c9bbf8bb2 --
-- Boot e949ffdb3bfb4700b9f20983536bc427 --
-- Boot 51fba15e621c45f78a6d14d65f10ca9d --
-- Boot 51c6cafca5344cedbd30f59ddb27adaa --
nclarius commented 2 years ago

I'm sorry, but I am still not able to reproduce it and don't have an idea what it could be. I'm also at my wit's end with the non-functioning logging. I'm afraid you'll have to live with the bug until further notice. Thank you for your help up to here!

I just published a new version integrating the gaps better with the floating panels introduced with the newest Plasma release.

Akselmo commented 2 years ago

Ah well, thank you for trying. I can try to see if I could fix it myself when I have time.

Akselmo commented 2 years ago

Hey!! Good news, I managed to get you some logs!

I had to set the export QT_LOGGING_RULES="kwin_*.debug=true" to /etc/environment/ and now I can see the logs!

Here you go: tilegaps.log

What I was exactly doing was moving a window to the rightmost half of my (last) second monitor. When it snaps to a window-x that is quarter tiled to top-left on that monitor, and i tile the new window-y full half on the right side of it, window-y snaps to window-x and starts resizing down from the right side.

One thing I am wondering about is that does the script ignore widgets on desktop? Since I have widgets on the very right edge of my monitor.

Edit1: It's not the widgets, it happens even without them. There's a window named "0" that keeps resizing the other windows..

Edit2: Interesting, if I enable floating panel mode to Left screen edge, it stops doing this. Right screen edge does not stop it. Is it overshooting the coordinates perhaps? Now that I look at it, it puts the window sliiiightly outside of the monitor on the right side.

Edit3: The following in "left edge" let diff = coords.gapped - win[edge]; is forever stuck in -2.

nclarius commented 2 years ago

Yay!

That was indeed a logic error; good catch! I just released an update; please test whether this solves the problem.

Akselmo commented 2 years ago

This solved the shrinking problem (however it reintroduces itself if i have any floating panels checked, but i can live without that), but now there's overlap between windows, and the window still goes a bit over the right edge of screen.

image

Jun 23 10:57:49 fedora kwin_wayland[1390]: js: tilegaps: frame geometry changed ~ : bash — Konsole <2>
Jun 23 10:57:49 fedora kwin_wayland[1390]: js: tilegaps: gaps for ~ : bash — Konsole <2> x 961 960 1921 y 31 1044 1075
Jun 23 10:57:49 fedora kwin_wayland[1390]: js: tilegaps: area x 0 1920 1920 y 26 1054 1080
Jun 23 10:57:49 fedora kwin_wayland[1390]: js: tilegaps: gap to edge right fullRight 1915
Jun 23 10:57:49 fedora kwin_wayland[1390]: js: tilegaps: new geo x 961 960 1921 y 31 1044 1075
Jun 23 10:57:49 fedora kwin_wayland[1390]: js: tilegaps: gap to edge bottom fullBottom 1075
Jun 23 10:57:49 fedora kwin_wayland[1390]: js: tilegaps: new geo x 961 960 1921 y 31 1044 1075

if im reading this right, the 1921 indicates that the new geometry is overstepping a bit.

nclarius commented 1 year ago

Sorry for the long inactivity. Please check if the newest update fixes the bug for you.

Akselmo commented 1 year ago

So far so good, I'll keep testing over longer period and report if theres any issues. Thanks!