diff options
| author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2026-11-23 21:33:28 +0200 |
|---|---|---|
| committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2026-12-01 23:02:47 +0200 |
| commit | ee5c222bf5d94fa993c44a6d0e1f53d82c962870 (patch) | |
| tree | f5cd62d3abedba3865ecffcad39a6a6f18876fc3 /script-output/contents/ui/main.qml | |
Diffstat (limited to 'script-output/contents/ui/main.qml')
| -rw-r--r-- | script-output/contents/ui/main.qml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/script-output/contents/ui/main.qml b/script-output/contents/ui/main.qml new file mode 100644 index 0000000..6a52308 --- /dev/null +++ b/script-output/contents/ui/main.qml @@ -0,0 +1,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") + } +} |
