Commit Graph

78 Commits (42dfdb63b03a6beca314f61bd61981dc1724909b)

Author SHA1 Message Date
Martin Gräßlin 42dfdb63b0 Global Shortcut support for KWin scripts and scripted Effects
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
2012-03-30 08:20:10 +02:00
Martin Gräßlin e0f97946af Add QML specific export of ClientList
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()
2012-03-27 22:21:06 +02:00
Script Kiddy 8011e80652 SVN_SILENT made messages (.desktop file) 2012-03-26 09:55:50 +02:00
Script Kiddy 446ddcd134 SVN_SILENT made messages (.desktop file) 2012-03-24 11:23:48 +01:00
Martin Gräßlin dab146422a Make KWin::Client known to QML 2012-03-24 10:49:21 +01:00
Martin Gräßlin 98ce0cbc78 Add parameter names to signals in KWin Scripting
Apparently needed for QML bindings.
2012-03-21 18:55:32 +01:00
Martin Gräßlin 4e0ab36ae9 Add an AnimationData class for meta values
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
2012-03-12 21:37:47 +01:00
Martin Gräßlin 6baafd28cd Remove unused code 2012-03-12 21:37:42 +01:00
Martin Gräßlin 06b6ea1199 Export another enum 2012-03-12 21:37:42 +01:00
Martin Gräßlin fa66940966 Drop Plasma::ConfigLoader again
It doesn't make really any sense for the effects. Instead the
JS API allows to specify a default value for not present keys.
2012-03-12 21:37:42 +01:00
Martin Gräßlin 875df96143 Fix exporting of EffectWindowList to scripts 2012-03-12 21:37:42 +01:00
Martin Gräßlin 048540a7c5 Fix error in package structure of scripted effects
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.
2012-03-12 21:37:41 +01:00
Martin Gräßlin 8175278526 Make displayWidth/Height available to scripts 2012-03-12 21:37:41 +01:00
Martin Gräßlin 5246de285b Export animationTime to Scripted KWin effects 2012-03-12 21:37:41 +01:00
Martin Gräßlin 8996876044 Scripted effects become configurable
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.
2012-03-12 21:37:40 +01:00
Martin Gräßlin e363c6bb18 Adding a method to allow scripts to test whether a window is grabbed 2012-03-12 21:37:40 +01:00
Martin Gräßlin e824412535 Export FPx2 to scripted effects
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.
2012-03-12 21:37:40 +01:00
Martin Gräßlin 5592dffb48 JavaScript bindings for KWin effects
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.
2012-03-12 21:37:40 +01:00
Martin Gräßlin d4a919a9bf Demands Attention support for KWin Scripting
Client has a property for demands attention and Workspace
is emitting a signal whenever the demands attention state
of any Client changes.

REVIEW: 104204
2012-03-12 21:25:45 +01:00
Martin Gräßlin bfc406e073 QtScript wants namespaces params 2012-03-09 18:20:50 +01:00
Martin Gräßlin 214375f923 Query KWin for available debug output
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
2012-03-04 15:21:10 +01:00
Martin Gräßlin 3600fe5ed8 Support loading/unloading of scripts on config change
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
2012-03-02 09:10:21 +01:00
Martin Gräßlin b7d95a1b09 Fix global script methods
The callee is an AbstractScript and we should make sure that
the script is not already deleted.
2012-03-02 09:10:11 +01:00
Martin Gräßlin 95ac5fa2ce Service Type property to exclude KWin Scripts from listing in KCM
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.
2012-03-02 09:10:11 +01:00
Martin Gräßlin 87fede97a1 Configuration support for KWin scripts
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.
2012-03-02 09:10:10 +01:00
Martin Gräßlin 3f1ef8bb8d Export KWin::Options to KWin scripts 2012-03-02 09:10:10 +01:00
Martin Gräßlin 6a8b79f699 Support declarative KWin scripts
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.
2012-03-02 09:10:10 +01:00
Martin Gräßlin f9ad0621d5 Drop script dir variable
Not needed any more.
2012-03-02 09:10:10 +01:00
Script Kiddy 292ceee506 SVN_SILENT made messages (.desktop file) 2012-03-01 09:46:02 +01:00
Script Kiddy dd026bdd9f SVN_SILENT made messages (.desktop file) 2012-02-29 10:25:11 +01:00
Script Kiddy fc9dcf9e82 SVN_SILENT made messages (.desktop file) 2012-02-23 09:52:44 +01:00
Script Kiddy 7397a5dc6a SVN_SILENT made messages (.desktop file) 2012-02-20 09:55:34 +01:00
Martin Gräßlin c76317fa0f Export Desktop Name to scripts 2012-02-19 17:01:30 +01:00
Martin Gräßlin 356b406ae3 Export screen information to scripts 2012-02-19 17:01:22 +01:00
Martin Gräßlin db04ab7f36 KWin scripts use Plasma package structure
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.
2012-02-18 10:40:39 +01:00
Thomas Lübking 85635dd485 fix tabbing
BUG: 290959
BUG: 265160
BUG: 229292
BUG: 238279
BUG: 290758
BUG: 222831
BUG: 278275
BUG: 245747
BUG: 230000

BUG: 253697
BUG: 230570
BUG: 265977
BUG: 225337
BUG: 225339

REVIEW: 103855
2012-02-11 16:30:22 +01:00
Thomas Lübking bf88ec09ac Revert "fix tabbing"
pushed out of branch, not master - leading to absent revision, found hash collision??

This reverts commit 94b2ad7b85801e37e2df4671cdc4f26b6d7e5506.
2012-02-11 16:29:14 +01:00
Thomas Lübking d245035a17 fix tabbing
BUG: 290959
BUG: 265160
BUG: 229292
BUG: 238279
BUG: 290758
BUG: 222831
BUG: 278275
BUG: 245747
BUG: 230000

BUG: 253697
BUG: 230570
BUG: 265977
BUG: 225337
BUG: 225339

REVIEW: 103855
2012-02-11 16:01:41 +01:00
Martin Gräßlin 6185bf00d3 Export useraction slots to scripting
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...
2012-01-27 07:35:40 +01:00
Martin Gräßlin 651a0cca47 Export clientArea methods to scripting
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.
2012-01-26 22:56:24 +01:00
Martin Gräßlin cf5b70bd2c Export displayWidth/height/size as properties of workspace 2012-01-26 16:53:07 +01:00
Martin Gräßlin 55088ba776 Remove repetitive code in WorkspaceWrapper 2012-01-26 08:37:38 +01:00
Martin Gräßlin 26d069981d Add property for number of desktops to scripting
Adding macros to define the wraping code.
2012-01-26 08:37:25 +01:00
Martin Gräßlin 0dbfdf4979 Simplify the Timer in scripting
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.
2012-01-22 13:02:34 +01:00
Martin Gräßlin 20d8d727ca Rename SWrapper::Workspace to KWin::WorkspaceWrapper
Resolves the problem of having two workspace.(h|cpp). The scripting
workspace is in fact just a wrapper, so having that clear is a plus.
2012-01-22 12:38:03 +01:00
Martin Gräßlin 03e892fcc9 Workspace Wrapper uses Q_PROPERTIES
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.
2012-01-21 17:48:07 +01:00
Martin Gräßlin 507ff411d6 Drop the WorkspaceProxy in Scripting
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.
2012-01-21 10:51:22 +01:00
Martin Gräßlin 49b24e4940 Clean-up Scripting Wrapper for Workspace
No need to manually convert everything to script values.
2012-01-21 10:04:47 +01:00
Martin Gräßlin 4f54cd95ee Fix singleton creation of WorkspaceProxy
What in scripting does actually work in the way it is supposed to
work?
2012-01-20 16:34:57 +01:00
Martin Gräßlin a04cb2ed09 Drop also the IMPLIST as it is outdated 2012-01-01 15:06:45 +01:00