|
plasma-show-stdout
A KDE Plasma 6 widget that displays stdout of shell scripts to the panel
|
A KDE Plasma 6 widget (plasmoid) that displays the standard output of shell scripts directly in your panel. The user can point it at one or more scripts, choose how each is triggered, and the widget shows the combined text output inline — with a configurable delimiter between each script's output — and offers a click-to-open popup for the full, scrollable text.
Each script runs on its own thread in a C++17 back end exposed to QML as a plugin. Two script execution modes are supported:
The output of every configured script is joined with a single, user-configurable delimiter (default " | ") into one line. Per-script output limits (counted in characters, UTF-8-aware so multi-byte glyphs are never split) make sure the output fits the panel. The display font is configurable, so glyph-rich fonts (e.g. a Nerd Font) render Unicode and symbol output correctly.
Extra CMake Modules (ECM) is used by the build. If it is not installed system-wide it is fetched automatically via CMake FetchContent. Catch2 (for the test suite) is likewise fetched on demand.
The recommended way to use the widget in a running desktop is a system-wide install, which lands the C++ plugin on a default Qt6 QML import path so no extra environment variables are needed.
Then open Add Widgets..., search for show-stdout, and drag it onto a panel or the desktop.
Tip: configure the system build from a clean build/ directory. ECM caches the QML install dir; reusing a build directory that was first configured with a different CMAKE_INSTALL_PREFIX can install the plugin to the wrong path and make the widget fail to load with a misleading "written for an unknown older version of Plasma" error. If in doubt, force it with -DKDE_INSTALL_QMLDIR=lib/qt6/qml.
A user-prefix plugin installs under your private QML dir, so launchers must be told where to find it:
To make it loadable from plasmashell's Add Widgets panel without setting the variable each time, persist QML_IMPORT_PATH via ~/.config/plasma-workspace/env/qml-import-path.sh and restart plasmashell.
Scripts must be executable and runnable as-is (the back end runs them via popen). If a script path does not exist, the widget shows a "<script_name> does not exist" message in place of its output rather than failing silently.
A Signal script runs only when its host process receives RTMIN+N. The host is the process the widget is loaded into: normally plasmashell (or plasmoidviewer / plasmawindowed when testing). The config dialog shows the exact command to use, including the detected host name, for example:
Use pkill (a real binary) rather than the shell's kill builtin: some shells (e.g. zsh) do not accept an RTMIN+N signal specification. Sending the signal to the wrong process fails silently, but may have unintended side effects if that process happens to change its behavior on receiving the signal. Match the host name shown in the dialog.
Build types are Release (default), Debug, Profile, and Test.
Building tests is optional and unnecessary for normal use. A small performance hit may be incurred when running the plugin compiled for testing. The test suite uses Catch2 and is built and run with CTest. Address and leak sanitizers are enabled automatically in Test builds where supported.
There are two test executables: one for the Qt-free module layer (runScript, truncateUtf8, TimedModule, SignalModule) and one for the QML-bridge layer (ScriptOutput).
The C++ plugin's public headers are documented with Doxygen. Building the docs is optional (requires doxygen); a small custom stylesheet (plugin/docs/bayesic.css) is applied — no external theme is fetched:
The HTML lands in plugin/docs/doxygen/html/ (open index.html); the project README is used as the front page.
The interface is translation-ready: all user-facing strings (the QML UI and the backend's error messages) are wrapped for gettext/KI18n, under the domain plasma_applet_com.github.tonymugen.plasma-show-stdout. Run ./Messages.sh to regenerate the po/<domain>.pot template. To add a language, create po/<lang>/<domain>.po from the template (msgmerge to update it later); the build compiles and installs it automatically. No translations ship yet.
plasmawindowed does not expose the widget's context menu, so it cannot reach the config UI. To test configuration, use plasmoidviewer (from the plasma-sdk package), which has an explicit Configure button:
When a structural change (e.g. new config files) is not picked up, rebuild the Plasma cache with kbuildsycoca6 --noincremental and clear the host's compiled QML cache under ~/.cache/<host>/qmlcache.
See CLAUDE.md for a detailed architecture overview and build notes. I used Claude Code (the Opus model) for development, in particular for building and calling the Qt API, debugging widget loading problems, and writing unit tests. I defined step-by-step goals, then inspected and edited the code before each commit.
BSD 3-Clause. See [LICENSE](LICENSE).