|
plasma-show-stdout
A KDE Plasma 6 widget that displays stdout of shell scripts to the panel
|
QML bridge exposing combined script output. More...
#include <plasma-show-stdout.hpp>
Signals | |
| void | textChanged () |
| Change-notification signal for the text property. | |
| void | delimiterChanged () |
| Change-notification signal for the delimiter property. | |
Public Member Functions | |
| ScriptOutput (QObject *parent=nullptr) | |
| QML constructor. | |
| ScriptOutput (std::vector< ModuleSpec > specs, QObject *parent=nullptr) | |
| Constructor from a list of module specifications. | |
| ~ScriptOutput () override | |
| Destructor. | |
| QString | text () const |
| Text output. | |
| QString | delimiter () const |
| Delimiter inserted between module outputs. | |
| void | setDelimiter (const QString &delimiter) |
| Set the delimiter inserted between module outputs. | |
| int | maxSignalOffset () const |
| Largest valid realtime-signal offset. | |
| qint64 | hostPid () const |
| PID of the process hosting this plugin. | |
| QString | hostName () const |
| Command name of the process hosting this plugin. | |
| Q_INVOKABLE void | setModules (const QVariantList &specs) |
| (Re)configure the running modules from QML | |
QML bridge exposing combined script output.
QObject registered with QML as the ScriptOutput type. Owns the worker and bridge threads for a list of ModuleSpecs and joins their outputs into the text property for display. Constructed empty by QML, then (re)configured at runtime via setModules. The exposed properties and methods are documented individually below.
|
explicit |
QML constructor.
The entry point used by QML, which can only invoke a (QObject *parent) constructor. Starts with an empty module list (defaultSpecs()); the QML config wiring then populates it at runtime via setModules. Delegates to the spec-taking constructor.
| [in] | parent | Pointer to the parent object |
|
explicit |
Constructor from a list of module specifications.
Spawns one worker (and bridge) thread per spec, in the given order; their outputs are joined into the text property. This is the real constructor; the QML constructor delegates to it.
| [in] | specs | modules to run, in display order |
| [in] | parent | Pointer to the parent object |
|
inline |
Delimiter inserted between module outputs.
| QString PSSspace::ScriptOutput::hostName | ( | ) | const |
Command name of the process hosting this plugin.
Read from /proc/self/comm, i.e. exactly what pkill <name> matches against (the kernel comm, truncated to 15 characters). Exposed so the config UI can show a working pkill --signal RTMIN+N <name> trigger command: the kill shell builtin (e.g. zsh's) does not accept an RTMIN+N signal spec, whereas pkill (a real binary) does. The name is the actual host — plasmashell, plasmoidviewer, plasmawindowed — so the command targets the right process regardless of how the widget is run.
| qint64 PSSspace::ScriptOutput::hostPid | ( | ) | const |
PID of the process hosting this plugin.
The PID of the process the plugin is loaded into (plasmashell in normal use, or plasmawindowed/plasmoidviewer when testing). A signal module is triggered by sending SIGRTMIN+N to this process, so the config UI shows this PID to make the trigger command unambiguous regardless of which host is running the widget.
| int PSSspace::ScriptOutput::maxSignalOffset | ( | ) | const |
Largest valid realtime-signal offset.
The inclusive upper bound for a signal module's RTMIN offset, i.e. SIGRTMAX - SIGRTMIN. Exposed so the config UI can size its spinbox without hard-coding glibc-specific signal numbers (SIGRTMIN/ SIGRTMAX are runtime calls, not constants).
| void PSSspace::ScriptOutput::setDelimiter | ( | const QString & | delimiter | ) |
Set the delimiter inserted between module outputs.
A single delimiter is used between every adjacent pair of fragments (the underlying join is one string, not per-module). Rebuilds and re-emits text immediately from the existing fragments, so the display updates without restarting any worker. Runs on the GUI thread (as does the bridge's text rebuild), so no locking is needed.
| [in] | delimiter | the new separator (empty joins with nothing) |
| Q_INVOKABLE void PSSspace::ScriptOutput::setModules | ( | const QVariantList & | specs | ) |
(Re)configure the running modules from QML
Tears down any currently running modules and starts the ones described by specs. Each entry is a map with keys kind (0 = Timed, 1 = Signal), script (path string), interval (seconds, Timed only), signalOffset (RTMIN offset, Signal only) and optional outputLimit. Entries with an empty script are skipped. This is the runtime entry point the QML config wiring calls; the signal number passed to a SignalModule is computed here as SIGRTMIN + signalOffset.
| [in] | specs | module descriptions, in display order |
|
inline |
Text output.