Using javascript-api extension LaunchApp and plasmoid.runCommand in Plasma 5 plasmoid

Aditya Mehra adix.me at gmail.com
Fri Dec 23 15:37:21 UTC 2016


Hi,

Not sure where to find support for this, but i am trying to use the
LaunchApp javascript-api extension in a plasmoid, to launch a shell script
via a button in my main.qml file. I came across this api extension on
https://techbase.kde.org/Development/Tutorials/Plasma4/JavaScript/API-LaunchApp
which is for plasma 4. Is this still valid for plasma 5 ?

I tried using this in my plasmoid but am getting an error "TypeError:
Property 'runCommand' of object AppletInterface(0x1a28320) is not a
function"

Main.qml button:

import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras

 Button {
            id: startservicebutton
            width: parent.width
        anchors.fill: parent
            height: 36
            text: qsTr("Start Service")

            MouseArea {
                id: mouseArea1
                Layout.fillWidth: true;
                anchors.fill: parent
                height: parent.height
                hoverEnabled: false

                onClicked: {
                                 plasmoid.runCommand("bash",
["servicestart.sh"]);
                    }
        }
    }

Metadata.desktop entry:

X-Plasma-Requires-LaunchApp=Required
X-Plasma-RequiredExtensions=LaunchApp

Is there any alternative way to run this javascript-api extension or new
syntax in plasma 5 or a single shell command without having to use C++ from
a qml plasmoid ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20161224/b3e05bbe/attachment.html>


More information about the Plasma-devel mailing list