From ee5c222bf5d94fa993c44a6d0e1f53d82c962870 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Mon, 23 Nov 2026 21:33:28 +0200 Subject: initial commit --- script-output/contents/ui/main.qml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 script-output/contents/ui/main.qml (limited to 'script-output/contents/ui/main.qml') 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") + } +} -- cgit v1.2.3