blob: 6a52308913ef59c50426b03dd0ee7f61c692f8cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
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")
}
}
|