import QtQuick import QtQuick.Layouts import org.kde.plasma.components as PlasmaComponents import org.kde.plasma.plasma5support as Plasma5Support import org.kde.plasma.plasmoid PlasmoidItem { id: root readonly property string command: Plasmoid.configuration.command.trim() property string output: "" preferredRepresentation: fullRepresentation Plasma5Support.DataSource { id: executable engine: "executable" connectedSources: root.command ? [root.command] : [] interval: 5000 onNewData: function(source, data) { if (source === root.command && typeof data.stdout === "string") root.output = data.stdout.replace(/\s+$/, "") } } fullRepresentation: PlasmaComponents.Label { Layout.minimumWidth: Math.max(1, implicitWidth) Layout.minimumHeight: implicitHeight textFormat: Text.PlainText verticalAlignment: Text.AlignVCenter text: root.command ? root.output : i18n("Configure a command") } }