|Tutorial Series||Plasma Tutorial|
Before we start to program or little addon we need to do some setup. First of all, we create a directory called MyFirstJSAddon, where our addon will be located, with the following directory structure:
In the root directory of our addon, we create a file metadata.desktop with the following content:
X-KDE-Library= X-KDE-PluginInfo-Author=<Your name here> X-KDE-PluginInfo-Email=<Your email here> X-KDE-PluginInfo-Name=org.myorg.myJSInterface.myJSAddon X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Website=http://plasma.kde.org/ X-KDE-PluginInfo-Category=org.myorg.myJSInterface X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=LGPL X-KDE-PluginInfo-EnabledByDefault=true
The next step is to provide our Addon a method, which print out our input.
At the end of your Addon it is also important that you "publish" your class for other instances that would like to use it.
Now, we should save our written code into MyFirstJSAddon/contents/code and name it main.js.
To install this addon, simply navigate to the root directory of our addon and type this into the console: