Scripting: Provides methods to create and remove virtual desktops
ClosedPublic

Authored by tcorreabr on May 15 2020, 7:06 PM.

Details

Summary

There are methods to create and remove virtual desktops via dbus, but I think it would be convenient to provide these methods for KWin scripts as well.

Diff Detail

Repository
R108 KWin
Lint
Lint Skipped
Unit
Unit Tests Skipped
tcorreabr created this revision.May 15 2020, 7:06 PM
Restricted Application added a project: KWin. · View Herald TranscriptMay 15 2020, 7:06 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
tcorreabr requested review of this revision.May 15 2020, 7:06 PM
zzag added a subscriber: zzag.May 18 2020, 9:00 AM
zzag added inline comments.
scripting/workspace_wrapper.h
260

why not in range [0, count]?

zzag added inline comments.May 18 2020, 9:02 AM
scripting/workspace_wrapper.cpp
282–283

coding style nit: whitespace before * and put the return statement on a new line.

tcorreabr added inline comments.May 18 2020, 3:45 PM
scripting/workspace_wrapper.cpp
282–283

Ok. I'll do it.

scripting/workspace_wrapper.h
260

I don't know why but the client.desktop property is not zero based, at least on X11. So in a situation with 2 desktops, the new desktop can be inserted at position 1, 2 or 3.

zzag added inline comments.May 19 2020, 10:02 AM
scripting/workspace_wrapper.h
260

I don't know why but the client.desktop property is not zero based

It's not zero-based because of the goddamn X11...

So in a situation with 2 desktops, the new desktop can be inserted at position 1, 2 or 3.

In order to match what input values VirtualDesktopManager::createVirtualDesktop() expects, I think it's better to keep the position in range [0, count]. We could make client.desktop zero-based in plasma 6.

It's also worth to point out that the client.desktop property is deprecated since a window can be on more than just one virtual desktop.

tcorreabr updated this revision to Diff 83097.May 20 2020, 10:48 PM

Zero based position parameters.

tcorreabr marked 5 inline comments as done.May 20 2020, 10:49 PM
zzag accepted this revision.May 21 2020, 5:50 AM
This revision is now accepted and ready to land.May 21 2020, 5:50 AM
This revision was automatically updated to reflect the committed changes.