gerritdevriese / kzones

KDE KWin Script for snapping windows into zones
https://store.kde.org/p/1909220
GNU General Public License v3.0
238 stars 14 forks source link

Initial attempt to port to KWin 6 #63

Closed fynzhak closed 3 months ago

fynzhak commented 3 months ago

I made an attempt to port this script to KWin 6. I didn't know much about KWin scripting or QML before this, so I can't make any guarantees of quality.

There are a couple places where I'm not sure if I've maintained the desired behaviour or not:

  1. getWindowsInZone and switchWindowInZone use Workspace.StackingOrder. I think this means the order of windows in the list changes as you switch active windows. This means cycling through windows in a zone is broken. I was thinking maybe we sort the windows found in the zone, but figured I'd leave it open for discussion for now.
  2. Shortcuts for moving to a numbered zone are not dynamically generated. I tried dynamically creating a ShortcutHandler with Qt.createComponent() and createObject() but I couldn't get it to register the shortcuts. This goes well beyond my QML knowledge, but maybe hardcoding it like this isn't so bad.
  3. I wasn't sure about the previous onClientFullScreenSet() behaviour, but I took a guess at porting it. I could be totally wrong with the intent though.

Anyway, I don't expect this to be merged as is or anything, but hopefully it's helpful.

gerritdevriese commented 3 months ago
  1. getWindowsInZone and switchWindowInZone use Workspace.StackingOrder. I think this means the order of windows in the list changes as you switch active windows. This means cycling through windows in a zone is broken. I was thinking maybe we sort the windows found in the zone, but figured I'd leave it open for discussion for now.

Cycling through windows never worked very well, I always procrastinated looking into this because using the Tiling API would make for an easy fix. I also don't know if many people even use this feature, I sure don't.

  1. Shortcuts for moving to a numbered zone are not dynamically generated. I tried dynamically creating a ShortcutHandler with Qt.createComponent() and createObject() but I couldn't get it to register the shortcuts. This goes well beyond my QML knowledge, but maybe hardcoding it like this isn't so bad.

I guess we could solve this with a Repeater, but I'm not sure. We can do it like this for now.

  1. I wasn't sure about the previous onClientFullScreenSet() behaviour, but I took a guess at porting it. I could be totally wrong with the intent though.

This was done to fix a bug where the overlay would cover up some full screen games/windows. I don't know if this bug still exists but I guess leaving the fix in couldn't hurt?