KWin-window-geometry-scripts icon indicating copy to clipboard operation
KWin-window-geometry-scripts copied to clipboard

modified script for plasma 6 api

Open john-okeefe opened this issue 1 year ago • 16 comments

These are the changes for the plasma 6 api. This script is still not installable.

john-okeefe avatar Mar 13 '24 12:03 john-okeefe

When trying to install it does copy the folder over and edit the kwinrc file, however we get this error.

qt.dbus.integration: QDBusConnection: error: could not send signal to service "" path "/KPackage/" interface "org.kde.plasma.kpackage" member "packageInstalled": Invalid object path: /KPackage/

john-okeefe avatar Mar 13 '24 12:03 john-okeefe

Maybe it's with the kpackagetool6 command. When I list-types it's a bit different.

KPackageTool5

╰─λ kpackagetool5 --list-types
Package types that are installable with this tool:
Built in:
KPackage Structure Name  Path
-----------------------  --------------------
KPackage/Generic         kpackage/packages/
KPackage/GenericQML      kpackage/genericqml/

Provided by plugins:
KPackage Structure Name    Path
-------------------------  --------------------------
Plasma/Applet              plasma/plasmoids/
Plasma/ContainmentActions  plasma/containmentactions/
Plasma/DataEngine          plasma/dataengines/
Plasma/Generic             plasma/packages/
Plasma/Theme               plasma/desktoptheme/

KPackageTool6

╰─λ kpackagetool6 --list-types
Package types that are installable with this tool:
Built in:
KPackage Structure Name  Path
-----------------------  --------------------
KPackage/Generic         kpackage/packages/
KPackage/GenericQML      kpackage/genericqml/

Provided by plugins:
KPackage Structure Name    Path
-------------------------  --------------------------
KSysguard/SensorFace       ksysguard/sensorfaces/
KWin/Aurorae               aurorae/themes/
KWin/Decoration            kwin/decorations/
KWin/Effect                kwin/effects/
KWin/Script                kwin/scripts/
KWin/WindowSwitcher        kwin/tabbox/
Plasma/Applet              plasma/plasmoids/
Plasma/Comic               plasma/comics/
Plasma/ContainmentActions  plasma/containmentactions/
Plasma/Generic             plasma/packages/
Plasma/LayoutTemplate      plasma/layout-templates/
Plasma/LookAndFeel         plasma/look-and-feel/
Plasma/Shell               plasma/shells/
Plasma/Theme               plasma/desktoptheme/
Plasma/Wallpaper           plasma/wallpapers/
Wallpaper/Images

john-okeefe avatar Mar 13 '24 12:03 john-okeefe

Thanks @zzag . I'm not really familiar with KDE scripting. I jumped into this to really just get swap sides back. Any idea on why the install will not work?

john-okeefe avatar Mar 13 '24 14:03 john-okeefe

Thanks @zzag . I'm not really familiar with KDE scripting. I jumped into this to really just get swap sides back. Any idea on why the install will not work?

He replied elsewhere with

metadata.desktop file should be converted to metadata.json and in metadata.json, ServiceTypes: ["KWin/Script"] should be replaced with "KPackageStructure": "KWin/Script" KPackageStructure should be in the toplevel object i.e.

{
    "KPackageStructure": "KWin/Script",
    "KPlugin" : {}
}

For the metadata file conversion there is a command-line tool, desktoptojson, part of the kcoreaddons package.
The metadata structure is the one reflected now in https://develop.kde.org/docs/plasma/kwin/#metadata.

I can take a shot at it in the coming days but if you want to finish it up go ahead :)

nclarius avatar Mar 13 '24 15:03 nclarius

I converted to metadata.json and made sure it looked like the example. However, the shortcut is not swapping windows. I'm not really sure how to debug in Plasma, but it does seem like we are getting there and hopefully, finishing this will allow the other scripts to be updated as well.

john-okeefe avatar Mar 15 '24 15:03 john-okeefe

Also change win.geometry to win.frameGeometry in lines 22 27 59 64 maybe it will work then

roadbloack avatar Mar 17 '24 09:03 roadbloack

@mashrit That did not work. I even tried changing it on 32, 39, 69 and 76 for good measure. No-go.

john-okeefe avatar Mar 19 '24 11:03 john-okeefe

Sorry i did not see those on the loop lines, But from what i know geometry was changed to frameGeometry

roadbloack avatar Mar 20 '24 11:03 roadbloack

On here https://invent.kde.org/plasma/kwin/-/wikis/Porting-your-scripts-to-KWin-6

It says workspace.clientlist() is replaced by workspace.clients

roadbloack avatar Mar 22 '24 16:03 roadbloack

Hello @mashrit ,

I tried that change and it still didn't work. Based on the advice here for some debugging (although I don't really think it helped), I ran the command below and grabbed the output of running the keyboard shortcut.

Debug Kwin Script

export QT_LOGGING_RULES='*.debug=true; js=true; kwin_scripting=true'
kwin_x11 --replace &
journalctl -g "js:" -f

And here is what I got:

js: swapsides: left and right
qt.qml.overloadresolution: ::: considering signature "clientArea(ClientAreaOption,const KWin::Window*)"
qt.qml.overloadresolution: updated best bestParameterScore 0
bestMaxMatchScore 4
bestSumMatchScore 4

qt.qml.overloadresolution: ::: considering signature "clientArea(ClientAreaOption,KWin::Window*)"
qt.qml.overloadresolution: did not update best
bestParameterScore 0    methodParameterScore 0
bestMaxMatchScore 4     maxMethodMatchScore 4
bestSumMatchScore 4     sumMethodMatchScore 4

qt.qml.overloadresolution: ::: considering signature "clientArea(ClientAreaOption,KWin::Output*,KWin::VirtualDesktop*)"
qt.qml.overloadresolution: rejected, insufficient arguments

john-okeefe avatar Mar 22 '24 16:03 john-okeefe

Okay. I'm not sure what happened, but this code now seems to work. clients() didn't work, but windowList() does.

john-okeefe avatar Mar 22 '24 16:03 john-okeefe

If someone else can verify it working with their setup, I think it can be pushed to main and used as a reference for the rest of the repo.

john-okeefe avatar Mar 22 '24 16:03 john-okeefe

@mashrit @nclarius @zzag Thank you all so much for your help!

john-okeefe avatar Mar 22 '24 16:03 john-okeefe

working for me(Wayland)

roadbloack avatar Mar 23 '24 09:03 roadbloack

It seems having panels in way messes somethings up for me window sizes change when swapped and go back when swapped again

roadbloack avatar Mar 23 '24 09:03 roadbloack