darkstego / Mudeer

KDE Plasma Screen Splitting Shortcuts ideal for Ultrawide and Super-Ultrawide Monitors
MIT License
157 stars 13 forks source link

Plasma 6 compatibility #20

Closed stefan-matic closed 6 months ago

stefan-matic commented 6 months ago

After updating to Plasma 6 it seems Mudeer is no longer working.

Unable to find the installation in kwin scripts and it fails after trying to install manually with the following errors:

╰─❯ cd Mudeer && make install

(cd package && zip -r mudeer.kwinscript ./*)
adding: contents/ (stored 0%)
adding: contents/code/ (stored 0%)
adding: contents/code/mudeer.js (deflated 72%)
adding: contents/config/ (stored 0%)
adding: contents/config/main.xml (deflated 60%)
adding: contents/ui/ (stored 0%)
adding: contents/ui/config.ui (deflated 78%)
adding: metadata.json (deflated 51%)
(cd package && mv mudeer.kwinscript ../)
kpackagetool5 -t KWin/Script -s mudeer \
&& kpackagetool5 -u mudeer.kwinscript \
|| kpackagetool5 -i mudeer.kwinscript
kf.package: Invalid metadata for package structure "KWin/Script"
Package type "KWin/Script" not found
kf.package: Invalid metadata for package structure "KWin/Script"
kf.package: Cannot set a path in a package without structure "mudeer"
Error: Can't find plugin metadata: mudeer
kf.package: Invalid metadata for package structure "KWin/Script"
Package type "KWin/Script" not found
Successfully installed /home/stefanmatic/Workspace/volatile/Mudeer/mudeer.kwinscript

There seems to be a documentation for porting KWin 5 scripts to KWin 6 https://invent.kde.org/plasma/kwin/-/wikis/Porting-your-scripts-to-KWin-6

alanef commented 6 months ago

Same issue here, I'll see if I can fork / fix - worth a try anyway

alanef commented 6 months ago

I tried but failed to make progress :(

darkstego commented 6 months ago

Did you use the KDE6 branch?

stefan-matic commented 6 months ago

@darkstego That does seem to install it yes. Sorry didn't notice the branch before.

While I do see Mudeer installed and enabled, the shortcuts still don't work. I've made sure the binding are there in the shortcuts but it doesn't seem to function.

PRETTY_NAME="KDE neon 6.0"
NAME="KDE neon"
VERSION_ID="22.04"
VERSION="6.0"
VERSION_CODENAME=jammy

Plasma on Wayland (Worked before on Plasma 5 with Wayland)
alanef commented 6 months ago

Unfortunately too many things for me on KDE 6 don't work, so I switched distros from Neon the KBUNTU LTS so I could use this and some other tools so I cant test out now.

But great work @darkstego

sandro-mancuso commented 6 months ago

Did you use the KDE6 branch?

KDE6 branch seems to work, in that it can be installed. Unclear if this should be a separate issue(I haven't done any real troubleshooting), but it seems many of the shortcuts no longer work. For instance, Half middle, and half middle, top, work, but half-middle bottom doesn't. Center thirds also don't work.

If you can give me some hints on how to troubleshoot locally, I'd be happy to help and potentially fix. I've never done any work around kwin scripts before.

alanef commented 6 months ago

Have you checked the KDE shortcuts?

See from the readme

By picking these shortcut buttons, however, some of these shortcuts will not be enabled unless they are enabled manually through the KDE shortcut menu. This happens when some of those shortcuts overwrite others in KDE.

stefan-matic commented 6 months ago

@alanef Yes, the keybinds are bounded properly. I even tried to rebind them to a different combination that's not used (with ctrl, alt, shift and/or meta key) and none seem to work. I'm experiencing the same behavior @sandro-mancuso has. Is there any kind of way to debug and see what's happening with Mudeer?

darkstego commented 6 months ago

Honestly, debugging in kwin scripts is a real pain because there aren't any real tools. I can't think of any reason why the top half would work but the bottom half wouldn't. Unless there is a change in the way the dimensions are calculated.

I am currently not on KDE6, but I did briefly test the branch on a live ISO on one of the rc versions before launch. I didn't do extensive testing so there might have been some things that weren't working.

The only suggestion I would have for debugging is trying to adjust the values of the move function and see what arguments work and what don't, maybe there is a pattern there.

If I get the time I will try to find a way to run the release version of KDE6 and see if I can debug it.

sandro-mancuso commented 6 months ago

@stefan-matic have you by any chance tried on a fresh install? I have not, and I'm wondering if this explains some of it, as I noticed following your comments that you also updated KDE-Neon. The update to KDE6 completely broke my configuration, and it can't be ruled out that the source of the problem is that.

Today I realized that several shortcuts I used to use (and similar to this kwin-script, tried to reconfigure) no longer work. These are shortcuts to another kwin-script, as well as apps/executable scripts of my own.

darkstego commented 6 months ago

Rebinding shortcuts in KDE was a mess in KDE5, I don't know if anything changed, but when I first made the script every time I changed shortcuts I had to log out, edit kshortcut file and remove the shortcuts, log back in, then add shortcuts again.

It might be worth checking if you can add things that work and things that don't to different shortcuts to see if it is a problem with the function or with shortcut being registered

stefan-matic commented 6 months ago

@darkstego I've been looking up Plasma 6 related global shortcuts issues and seems there's a lot of them. The issue doesn't lie in Mudeer. I'll keep looking for a fix and post updates if I find any.

ttonyh commented 6 months ago

Using the kde6 branch, the install fails command: make install Arch Linux / Plasma 6.0.1

(cd package && zip -r mudeer.kwinscript ./*)
  adding: contents/ (stored 0%)
  adding: contents/config/ (stored 0%)
  adding: contents/config/main.xml (deflated 60%)
  adding: contents/ui/ (stored 0%)
  adding: contents/ui/config.ui (deflated 78%)
  adding: contents/code/ (stored 0%)
  adding: contents/code/main.js (deflated 72%)
  adding: metadata.json (deflated 50%)
(cd package && mv mudeer.kwinscript ../)
kpackagetool6 -t KWin/Script -s mudeer \
        && kpackagetool6 -t KWin/Script -u mudeer.kwinscript \
        || kpackagetool6 -t KWin/Script -i mudeer.kwinscript
kf.package: Could not find required file "mainscript" for package "/home/t/.local/share/kwin/scripts/mudeer/" should be QList("code/main.js")
Showing info for package: mudeer
  Name       : Mudeer
  Description: Tiling for Ultrawide and Super Ultrawide Monitors
  Plugin     : mudeer
  Author     : Abdulla Bubshait
  Path       :
KPackageStructure of KPluginMetaData(pluginId:"mudeer", fileName: "/home/t/.local/share/kwin/scripts/mudeer/metadata.json") does not match requested format "KWin/Script"
Error: Plugin mudeer is not installed.
kf.package: Could not find required file "mainscript" for package "/home/t/.local/share/kwin/scripts/mudeer/" should be QList("code/main.js")
Error: Installation of /home/t/Development/repos/Mudeer/mudeer.kwinscript failed: /home/t/.local/share/kwin/scripts/mudeer already exists
make: *** [Makefile:8: install] Error 4
algorithmraeparsons commented 6 months ago

I attempted to install from the kde6 branch like @ttonyh did (Arch Linux, Plasma 6.0.1), and received an identical error message. Ah well.

algorithmraeparsons commented 6 months ago

I was able to get Mudeer installed after deleting the mudeer folder in ~/.local/share/kwin/scripts/, but a lot of the functionality is broken, unfortunately. While the fullscreen shortcut still works, none of the thirds system I used does. I can see this would be really difficult to debug.

xdandys commented 6 months ago

I was able to install (using kde6 branch as suggested), but most of my favorite shortcuts didn't work too (in fact only about 10% of shortcuts worked). I managed to make it work by these steps:

  1. Uninstall Mudeer
  2. Logout from KDE session (this is important, without doing so kglobalshortcutsrc will get ovewritten)
  3. Edit ~/.config/kglobalshortcutsrc and remove all lines starting by Mudeer
  4. Install Mudeer again (make install)
  5. Now go to Settings->Window Management->Kwin scripts and you'll see Mudeer checked(enabled). Uncheck it, click Apply, Check it and click Apply again. Not sure why this re-enabling was neccessary.

After this procedure all shortcuts I normally use are working. I think this issue has something to do with migration of shortcuts configuration from Plasma5 -> Plasma6 and I believe it would work without issue on a fresh install.

stefan-matic commented 6 months ago

thank you @xdandys! Followed this guideline on both my machines and it seems to fix the shortcuts.

CypherDragon commented 6 months ago

+1 for @xdandys - I did need to rebind a few shortcuts because Plasma6 glommed on to them (Meta+Shift+A specifically) but other than that after cleaning up the existing Mudeer install from Plasma5, it's now working again. Cheers!