A global method "registerShortcut" is exported to the scripts which
can be used to register a callback to be called when the global
shortcut is triggered.
The shared code between Scripts and Effects is moved into template
functions defined in a new file scriptingutils.h.
REVIEW: 104400
Sometimes Qt is surprising. Apparently QML has problems with a
QList<KWin::Client*> and wants to have a QList<QObject*> which
cannot be used in QtScript.
There ends my dream of having one API for both JavaScript and QML.
So with QtScript it is:
workspace.clientList()
and in QML it is:
workspace.getClientList()
Objects of AnimationData can be instantiated by scripts and expose
all relevant data as properties, so that the ScriptedEffect can
construct the meta value out of it.
This is probably something that could be done a little bit better.
Still need to think about it, so API not yet final.
REVIEW: 103823
The Plasma package structure contains a subdirectory "contents".
Furthermore we have to use locate instead of locateLocal to find
system wide installed packages and adding some debug output for
the case that the script cannot be found.
The scripted effects can define their configuration through a
KConfigXT file in the same way as a packaged Plasmoid. Because of
that the ScriptedEffect also uses the Plasma::ConfigLoader to load
and manage the configuration. The config group used for the scripted
effect is like any other effect the "Effect-name" group.
In difference to the Plasmoid JavaScript API effects are not allowed
to change their configuration.
Simplifies the API. An FPx2 can be defined as a single real value
or a complex object with two real values:
{
value1: 1.0,
value2: 2.0
}
For a default ctor a null value can be used.
Scripted effects follow the Plamsoid package structure and the effect
loader recognizes a scripted effect at the according line in the desktop
file. If it is a scripted effect a different loader is used which
instantiates an object of the ScriptedEffect class. This class inherits
the AnimationEffect and exports the animate method and the EffectsHandler.
Client has a property for demands attention and Workspace
is emitting a signal whenever the demands attention state
of any Client changes.
REVIEW: 104204
This adds extensive support information about the running instance
by printing out all used options, the compositing information
including GL platform, loaded effects and active effects.
The debug output can be retrieved through D-Bus:
qdbus org.kde.kwin /KWin supportInformation
or through a KWin Script (use desktop console):
print(workspace.supportInformation())
REVIEW: 104142
Whenever the KWin configuration is changed, scripting has to unload
scripts no longer loaded and load the scripts which have been added.
For this new methods are introduced to check whether the script is
loaded.
REVIEW: 104037
This is useful for scripts controlled from other KCMs, like e.g.
DesktopChangeOSD which is controlled by the virtual desktop KCM
and should not be listed in the scripts section.
New global method readConfig is exported to QtScript and declarative scripts.
Config is read from a config group stored in kwinrc called "Script-<pluginname>".
For this the ctors of the AbstractScript and derived classes are changed to also
take the pluginname.
For this the Script class is slightly refactored to have a common
base for JavaScript and QML based scripts.
Why QML bindings? This allows to use QML for example for the
desktop change OSD or for fullscreen effects like Present Windows.
Scripts are found by the KServiceTypeTrader and can now be
enabled/disabled. Loading of config is currently disabled. Will
be made available again after scripted effects are merged.
All slots not requiring to be triggered from a QAction are exported.
This means that switchToDesktop is not exported but also not required,
as we have this through the properties.
Needs documentation...
For this a new MetaObject "KWin" is exported to have the
enum ClientAreaOption available in scripts. Unfortunately this
requires duplicating the enum from kwinglobals.h.
Properties are already available thanks to QObject: no need to
export them again. Dropping the toString method allows to remove
the plasma-backportglobal.h file for which Krazy had many complains.
The idea is to extend the wrapper to have it wrapping even more
functions provided by Workspace. Of course it would be possible to
just add the properties to Workspace itself and export this. But I
think complete Workspace is just too powerful to fully expose to
scripts. So a small wrapper around the parts which are usefull for
scripts might make more sense.
This breaks now also the API for Workspace and again it is already
more powerful with less code than before.
Unlike stated at several places in the code it is not difficult to
setup the connections to all Clients.
It would have been nice if the failed attempts to connect the Clients
would not have made it into the code as emitted signals which are
nowhere used. Not to mention that like in all places the signals to
inform that a state changed were emitted before the state changed was
performed.