Configuration of KDE desktop applets, like the launcher ("Kickoff") or the clock is held in ~/.config/plasma-org.kde.plasma.desktop-appletsrc (at least for KDE 5). I'd like to configure the applets on a fresh system to my liking using Ansible, but I can't find a robust way to do that.

I know I can use kwriteconfig5 to change the values there, like so

kwriteconfig5 --file ~/.config/plasma-org.kde.plasma.desktop-appletsrc \
--group Containments --group 3 --group Applets --group 9 \
--group Configuration --group Appearance \
--key dateFormat isoDate

which would hide some items from the system tray if the number of containment (3) and the applet (9) would match to the clock applet like so


which isn't guaranteed to happen between installations, from what I've seen.

Is there some available elegant way to set the values for specific applets (plugins, in the config file)? Or is it necessary to write a script that will dig up the numbers for a specific app and then use the klunky kwriteconfig5 command?

  • did you manage to find a solution for this?
    – Or B
    Commented Jan 6, 2022 at 13:43
  • Nope, sorry. And I probably won't, since I've switched to XFCE.
    – butla
    Commented Jan 9, 2022 at 16:18
  • Nowadays I maintain my config and sync laptops with this tool/repo I made for myself. If some command has nice config files (don't change when the app does work or randomly) and plays along, I just keep its config as a file, so that I see its changes in Git. If it's "problematic" I'm running Python (the linked script) to set the file.
    – butla
    Commented Jul 16, 2022 at 12:00

4 Answers 4


A simplified solution on bash:

while IFS= read -r line
    [[ $line == *Applets* ]] && grp="$line"
    [[ $line == *org.kde.plasma.digitalclock* ]] && break
done < "$HOME/.config/$config"
ContGrp=$(echo "$grp" | awk -F\] '{print $2}' | awk -F\[ '{print $2}')
ApplGrp=$(echo "$grp" | awk -F\] '{print $4}' | awk -F\[ '{print $2}')

kwriteconfig5 --file "$config" \
  --group Containments --group "$ContGrp" --group Applets --group "$ApplGrp" \
  --group Configuration --group General \
  --key dateFormat isoDate

I have identified the best way to do this for Plasma 5.6. They have a scripting API, however, it is in javascript run with QJSEngine. This answer shows how to run the script from bash, configure applets, and add panel widgets. There are more examples in the official documentation. Documentation for the API bindings is available here for further research.

Identifying the specific keys you need to change per widget is best done by reading the applet's main.xml file in the applet source.

Run the script from bash:

qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "$contents"
var allPanels = panels();
var done = false;
for (var panelIndex = 0; panelIndex < allPanels.length; panelIndex++) {
    if (done){
    var p = allPanels[panelIndex];

    var widgets = p.widgets();
    for (var widgetIndex = 0; widgetIndex < widgets.length; widgetIndex++) {
        var w = widgets[widgetIndex];

        // Cycle through panels and widgets until we find the panel with the pager on it.
        if (w.type != "org.kde.plasma.pager"){

        // Add new widget to the same panel
        var wt = p.addWidget("org.kde.windowtitle");
        // Print the IDs so you could grab them from bash if you wanted

        done = true;

(Aside: I found that reordering the panel widgets wouldn't work from the scripting API; they only get added to the config in the AppletOrder key after a delay or something. However, capturing the group IDs lets them be modified from bash or a second script later. Script here for reference)

Here's the example from the documentation directly relevant to the original question:

// See previous examples for these functions.
function forEachWidgetInContainmentList(containmentList, callback) { ... }
function forEachWidget(callback) { ... }
function forEachWidgetByType(type, callback) { ... }

function widgetSetProperty(args) {
    if (!(args.widgetType && args.configGroup && args.configKey)) {

    forEachWidgetByType(args.widgetType, function(widget){
        widget.currentConfigGroup = [args.configGroup];

        //--- Delete when done debugging
        const oldValue = widget.readConfig(args.configKey);
        print("" + widget.type + " (id: " + widget.id + "):");
        print("\t[" + args.configGroup + "] " + args.configKey + ": " + oldValue + " => " + args.configValue);
        //--- End Debug

        widget.writeConfig(args.configKey, args.configValue);

    widgetType: "org.kde.plasma.digitalclock",
    configGroup: "Appearance",
    configKey: "dateFormat",
    configValue: "isoDate",

Remove all but the bare minimum configuration, and renumber all items as you wish, only having the Containment #1 and essential Applets.



Save it into ~/.config/plasma-org.kde.plasma.desktop-appletsrc, and do kquitapp5 plasmashell && kstart5 plasmashell to reload.

With your basic settings and numbers intact, other lacking lines will be automatically added by KDE.


I re-wrote Олексій Пирогов's answer as a function:



  while IFS= read -r line
    [[ $line == *Applets* ]] && grp="$line"
    [[ $line == *$applet* ]] && break
  done < "$applet_config"
  ContGrp=$(echo "$grp" | awk -F\] '{print $2}' | awk -F\[ '{print $2}')
  ApplGrp=$(echo "$grp" | awk -F\] '{print $4}' | awk -F\[ '{print $2}')

  kwriteconfig5 --file "$(basename "$applet_config")" \
    --group Containments --group "$ContGrp" --group Applets --group "$ApplGrp" \
    --group Configuration --group General \
    --key "$key" "$value"

# Example usage
configure_applet org.kde.plasma.digitalclock General dateFormat "isoDate"
configure_applet org.kde.windowtitle         General        style 3
                                                    # style 3 = Title - Application

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .