Filling org.kde.plasma.quicklaunch per user

Ludwig Cornelius t_d_l_c at gmx.de
Thu Oct 12 14:59:31 UTC 2017


Hi,

thank you for your answer.

My versions:
Plasma Version 5.10.4
KDE-Frameworks 5.39.0


My Javascript does work when I execute it manually via:
qdbus org.kde.plasmashell /PlasmaShell 
org.kde.PlasmaShell.showInteractiveConsole

I can see the change in 
~/.config/plasma-org.kde.plasma.desktop-appletsrc. But the quicklaunch 
bar doesn't show the changes immediately.

What I wanted is a per user initialisation of quicklauch bar. So I would 
need a user directory where I can put the js-File to be executed on 
first login, but
actually this wiki says this is not permitted for security reasons:
https://userbase.kde.org/KDE_System_Administration/PlasmaTwoDesktopScripting#Running_Scripts

So I wonder if there is another way to configure quicklaunch on first login.

Cheers,
Ludwig

---------
P.S. the script should write konsole-Icon to quicklaunch:

function printObj(myobj) {
     result = ""
     for(var propName in myobj) {
         propValue = myobj[propName]
         result = result + propName + " " + propValue + "\n";
     }
     return result;
}


function l(level, message) {
     if (level >= 0) print(message)
}


function addAppToQuicklaunch (appName) {

   try {
     l(0, arguments.callee.name + " " + appName);

     pids = panelIds;
     for (var i = 0; i < pids.length; ++i) { //search through the panels
       panel = panelById(pids[i]);
       if (!panel) continue;


       panel.currentConfigGroup = Array("Applets");
       noOfApplets = panel.configGroups.length;
       var groups = new Array();
       for (k = 0; k < noOfApplets; ++k) {
           groups.push(panel.configGroups[k])
       }

       for (k = 0; k < noOfApplets; ++k) {
           panel.currentConfigGroup = new Array("Applets", groups[k]);
           var pluginName = panel.readConfig("plugin");
           l(0, pluginName);

           if (pluginName == "org.kde.plasma.quicklaunch") {
              panel.currentConfigGroup = new Array ("Applets", 
groups[k], "Configuration", "General")
              var launchers = panel.readConfig("launcherUrls");
              l(0, launchers)
              panel.writeConfig("launcherUrls", 
"file:///usr/share/applications/org.kde.konsole.desktop");
              break;
           }
       }
       panel.reloadConfig()


       var widgetIds = panel.widgetIds;
       for (var j = 0; j < widgetIds.length; ++j) {

            widget = panel.widgetById(widgetIds[j]);


            l(0, widget.type)
            if (!widget || widget.type != "org.kde.plasma.quicklaunch") {
                continue;
            }

            widget.reloadConfig()


         }
     }
   }
   catch (err) {
     print("Error in " + arguments.callee.name + "\n" + err.message);
   }

}

addAppToQuicklaunch ("")


More information about the Enterprise mailing list