Skip to content

Draft: Add plasmashellconfig command to easily change widget config from terminal

Based on my plasmasetconfig.py script: https://gist.github.com/Zren/764f17c26be4ea0e088f4a6a1871f528

  • This tool generates and sends a plasma script over dbus, iterating every widget in every containment.
  • I also ported the terminal colors. I'll assume they are globally supported.
  • The code is fully implemented, however I don't know where I should place this. The other plasma-applet-___ tools are in the kcm dir however this isn't a GUI in System Settings.

The folder is a separate cmake project atm, so to test.

cmake -B build
cmake --build build
./build/bin/plasmashellconfig

Similar to qdbus, when no arguments are given, it prints all the plasmoid + wallpaper namespaces. It uses gray terminal coloring for the 4 directories as separators.

2021-03-26___22-47-14

When you pass at least 1 argument as the namespace, it'll parse the contents/config/main.xml for all the config group+keys. It'll also print the default value as an example of passing a new value. Lastly, the type is printed in gray formatted as a bash comment. The program name is printed in the beginning as well so a user can easily copy the entire line.

./plasmashellconfig org.kde.plasma.digitalclock
Usage: ./plasmashellconfig [options] widget group key value
plasmashellconfig org.kde.plasma.digitalclock Appearance showLocalTimezone false # Bool

2021-03-26___22-47-45

Note: The latest commits now display dateFormatStr ddd d # string as dateFormatStr "ddd d" # string.

Anyways, if you pass all 4 arguments, it quietly calls plasmashell's evaluateScript method over dbus.

./plasmashellconfig org.kde.plasma.digitalclock Appearance showDate true

Which is the equivalent of running:

qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "... really long plasma script ..."
Edited by Chris Holland

Merge request reports