Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting to Plasma 6? #10

Closed
CarlosEkisde opened this issue Mar 2, 2024 · 29 comments · Fixed by #12
Closed

Porting to Plasma 6? #10

CarlosEkisde opened this issue Mar 2, 2024 · 29 comments · Fixed by #12

Comments

@CarlosEkisde
Copy link

I tested it and it seems it's not working. Are you planning to port the script to Plasma 6?

@maurges
Copy link
Owner

maurges commented Mar 2, 2024

I use this script every day, so it's going to be fixed. But I don't have plasma6 on opensuse yet.. I didn't expect it to break honestly. I'll try to have a look at what they broke.

If you want to help, you can try to find some relevant logs is journalctl --user -u plasma-kwin_wayland.service -f

@CarlosEkisde
Copy link
Author

Hi. First of all, it seems that systemsettings is not detecting the installed script. I'm nor an expert or a programmer myself but comparing this script with a working Plasma 6 one, it seems that script proprieties are read from a metadata.json file rather than from the metadata.desktop file included here.

I've tried creating the metadata.json myself so systemsettings detects the script and it does so and I'm able to activate it from there.

Once it's enabled it does nothing. Running the journalctl command throws this error so it seems that at least it's trying to initializing it but it's not working yet.

mar 03 18:49:22 fedora kwin_x11[3424]: kwin_scripting: /home/Carlos/.local/share/kwin/scripts/dynamic-workspaces/contents/code/main.js:143: error: Cannot call method 'connect' of undefined

I'll attach too the metadata.json file I hope it helps even if it doesn't make the script to work by itself. I don't think making a PR for this is worthy.
metadata.json

@maurges
Copy link
Owner

maurges commented Mar 4, 2024

Thanks for the json file, this will be a huge help since I haven't even heard of them changing the format.

I explored the forums this weekend and it seems the KDE guys didn't make new docs yet, neither the migration guide. I found the changed apis in kwin headers, and there aren't many, and your error log points to one of those.

In the coming days I plan to set up a VM with kde neon or something and try rewriting.

@maurges
Copy link
Owner

maurges commented Mar 6, 2024

Wow, plasma6 black-screens in virtual box, both on nixos and kde neon. This becomes harder and harder with every day.

@CarlosEkisde
Copy link
Author

CarlosEkisde commented Mar 6, 2024

Wow, plasma6 black-screens in virtual box, both on nixos and kde neon. This becomes harder and harder with every day.

It works on a Xorg session. Plasma 6 has defaulted to Wayland and this combination doesn't work at all in VirtualBox.

I think Plasma 6 Wayland works on another virtualization software. What I do in VB is installing Fedora Everything Rawhide or 40 (minimal) and manually install the KDE desktop and after that, plasma-workspaces-x11 for x11 support. And I start the session with startx because is a virtual machine and I don't care :P

@0x5a17ed
Copy link

0x5a17ed commented Mar 7, 2024

Wow, plasma6 black-screens in virtual box, both on nixos and kde neon. This becomes harder and harder with every day.

I can recommend libvirt virtualization over virtualbox nowadays, the user experience has matured far enough and supports things such as hardware accelerated gpu virtualization. Using wayland in a qemu vm worked fine last time I used it.

As far as the compatibility with plasma 6 goes, running plasmapkg2 -l in my terminal yields a warning from plasmapkg:

kf.coreaddons.desktopparser: Unable to find service type for service "KWin/Script" listed in "/home/ags/.local/share/kwin/scripts/dynamic_workspaces//metadata.desktop" - service type search directories were ("/home/ags/.local/share", "/home/ags/.local/share/flatpak/exports/share", "/var/lib/flatpak/exports/share", "/usr/local/share", "/usr/share")
kf.coreaddons.desktopparser: Unable to find service type for service "KWin/Script" listed in "/home/ags/.local/share/kwin/scripts/dynamic_workspaces/metadata.desktop" - service type search directories were ("/home/ags/.local/share", "/home/ags/.local/share/flatpak/exports/share", "/var/lib/flatpak/exports/share", "/usr/local/share", "/usr/share")
kf.package: Invalid metadata for package structure "KWin/Script"
Package type "KWin/Script" not found
Listing service types: KWin/Script in /home/ags/.local/share/
kf.coreaddons.desktopparser: Unable to find service type for service "KWin/Script" listed in "/home/ags/.local/share/kwin/scripts/dynamic_workspaces/metadata.desktop" - service type search directories were ("/home/ags/.local/share", "/home/ags/.local/share/flatpak/exports/share", "/var/lib/flatpak/exports/share", "/usr/local/share", "/usr/share")

@maurges
Copy link
Owner

maurges commented Mar 7, 2024

Thanks, I should try libvirt sometime. I only use vbox because I've used it for a long time and know it's interface like my five fingers.

I managed to run plasma6 on x11 on nixos yesterday, and started working on it. There have been some pretty big changes to how desktops work now, and I found a funny bug in pager.

@0x5a17ed plasmapkg2 was deleted though? It's not in nixos's plasma. The forums tell me to use kpackagetool6 now, and it works with metadata.json file that monsieur CarlosEkisde gave

@DonQuiProgger
Copy link
Contributor

@maurges Let me know if i can help somehow.

I updated to plasma 6 on arch yesterday and i am missing dynamic workspace management.

@maurges
Copy link
Owner

maurges commented Mar 8, 2024

I made a straightforward rewrite and put it in this branch: https://github.com/maurges/dynamic_workspaces/tree/plasma6 - it seems to work on x11, and if any of you can verify it works on wayland, I would really appreciate it! Updated installation instuctions with kpackagetool6 are given in the readme.

Fun fact: you can now crash plasma from a kwin script.

I'm now going to make a version that works with both plasma 5 and 6.

@DonQuiProgger
Copy link
Contributor

DonQuiProgger commented Mar 8, 2024

I made a straightforward rewrite and put it in this branch: https://github.com/maurges/dynamic_workspaces/tree/plasma6 - it seems to work on x11, and if any of you can verify it works on wayland, I would really appreciate it! Updated installation instuctions with kpackagetool6 are given in the readme.

Fun fact: you can now crash plasma from a kwin script.

I'm now going to make a version that works with both plasma 5 and 6.

On install i got this:

kpackagetool6 --type KWin/Script --install .

qt.dbus.integration: QDBusConnection: error: could not send signal to service "" path "/KPackage/" interface "org.kde.plasma.kpackage" member "packageInstalled": Invalid object path: /KPackage/
Erfolgreich installiert: ~/.local/share/kwin/scripts/dynamic_workspaces/

But the script does not appear in systemsettings and i do not know how to activate it. kwin also does not give me any log output on install.

@netizen-ais
Copy link

I made a straightforward rewrite and put it in this branch: https://github.com/maurges/dynamic_workspaces/tree/plasma6 - it seems to work on x11, and if any of you can verify it works on wayland, I would really appreciate it! Updated installation instuctions with kpackagetool6 are given in the readme.

Fun fact: you can now crash plasma from a kwin script.

I'm now going to make a version that works with both plasma 5 and 6.

My wayland session is now dead, black screen and locked mouse pointer, only power button performs a shutdown. Even uninstalling (and deleting ~/.local/share/kwin) didn't fix it. X11 sesm to work

@maurges
Copy link
Owner

maurges commented Mar 8, 2024

My wayland session is now dead, black screen and locked mouse pointer

what the fuck

Actually, this sounds exactly the same as when I load wayland plasm6 in my virtualbox: doesn't react to anything, even ttys can't be accessed.

@DonQuiProgger
Copy link
Contributor

DonQuiProgger commented Mar 8, 2024

My wayland session is now dead, black screen and locked mouse pointer

what the fuck

Actually, this sounds exactly the same as when I load wayland plasm6 in my virtualbox: doesn't react to anything, even ttys can't be accessed.

In my wayland session nothing happens. All works fine besides of the script which seems not to be active... Restarting the plasma session didn't change nothing.

@DonQuiProgger
Copy link
Contributor

My wayland session is now dead, black screen and locked mouse pointer

what the fuck
Actually, this sounds exactly the same as when I load wayland plasm6 in my virtualbox: doesn't react to anything, even ttys can't be accessed.

In my wayland session nothing happens. All works fine besides of the script which seems not to be active... Restarting the plasma session didn't change nothing.

Ups sorry, did not check out the correct branch :-D. Works like a charm now.

@CarlosEkisde
Copy link
Author

I confirm it works in x11 too. Thank you =D

@omentic
Copy link

omentic commented Mar 9, 2024

Works great in Wayland here too. I'll keep driving it and report any bugs!

@netizen-ais
Copy link

My wayland session is now dead, black screen and locked mouse pointer

what the fuck

Actually, this sounds exactly the same as when I load wayland plasm6 in my virtualbox: doesn't react to anything, even ttys can't be accessed.

I've found and killed the culprit (it was not the script, ofc). It works flawlessly AFAICT. Thanks!

@r0skar
Copy link

r0skar commented Mar 9, 2024

Works good here! One small issue I noticed: When switching away from an empty workspace, it does so happen immediately without the usual animation. I guess the workspace is removed instantly and that prevents Kwin from starting/finishing the transition(?)

Operating System: Arch Linux 
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.9-arch1-1 (64-bit)
Graphics Platform: Wayland

@maurges
Copy link
Owner

maurges commented Mar 10, 2024

@r0skar I see what you mean. I ported the changes I made to plasma 5, and I get the missing animation with wayland, but not x11. Yeah it sucks, I'll try to fix it.

@wgalen
Copy link

wgalen commented Mar 13, 2024

The plasma6 branch seems to work for me on Arch with Wayland as well!

One minor thing though, when it creates a new workspace, that workspace is named "dyndesk". Ideally, it should follow KDE's default of Desktop %d and if I'm remembering right, that's what it did in Plasma 5.

Anyway, thanks for the quick solution!

@mrjovanovic
Copy link

Yet another confirmation, works as expected on Wayland, Plasma 6.0.1. dyndesk workspace name does appear frustratingly. Thank you so much for making this work and making it possible!

@netizen-ais
Copy link

Changing dyndesk to default isn't trivial, as it inherits from i18n, and some users could have them edited to Main, or First/second/...

@netizen-ais
Copy link

Anyway I tested an intermediate solution and created a PR

@maurges
Copy link
Owner

maurges commented Mar 13, 2024

dyndesk

This used to be easier in plasma 5, where it just picked a name for me. Maybe a similar api call exists in 6 and I just haven't found it yet.

I think a solution like "dyndesk $i" is good enough without internationalization.

@rodrigopmatias
Copy link

I have a question, is there a repository where this port is being handled?

I'd like to follow along to learn a little more about kwin-script development.

@maurges
Copy link
Owner

maurges commented Mar 13, 2024

@rodrigopmatias Just for you, I pushed a local branch where I did all of the work: https://github.com/maurges/dynamic_workspaces/tree/rewrite - be careful as there will be force-pushes

@exincore
Copy link

exincore commented Apr 12, 2024

This used to be easier in plasma 5, where it just picked a name for me. Maybe a similar api call exists in 6 and I just haven't found it yet.

I think a solution like "dyndesk $i" is good enough without internationalization.

Good news, workspace.createDesktop(workspace.desktops.length, undefined); will accomplish this behavior. I've tested it on Plasma 6 Wayland; it seems to behave as documented.

Documentation states name The name for the new desktop, if empty the default name will be used.

See https://develop.kde.org/docs/plasma/kwin/api/#functions-1.

@maurges
Copy link
Owner

maurges commented Apr 13, 2024

Documentation states

The docs are still for plasma 5 so not completely trustworthy, I've been rather looking at kwin source. But it's good that you verified it, I'll use it then.

I've been kind of busy with life for the last month, so no activity in this repo. But I hope to release a version with plasma 6 support in the store in the coming weeks.

@omentic
Copy link

omentic commented Apr 13, 2024

It's been very nice to use in the mean time 🙂

Thanks so much for writing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.