I want to run a plasma JavaScript file from command line, but the only solution I found so far involves a graphical script editor and requires a user interaction to run the script:

qdbus org.kde.plasma-desktop /MainApplication loadScriptInInteractiveConsole "$PLASMA_SCRIPT_FILE"

Is there any solution that does not require a user interaction?


Yes, you can (several places link to this question so I'm anwering here). Just use:

qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript

It takes a script, not a path for it, so valid use is for example:

qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var foo = 1;'
| improve this answer | |
  • Good to know that it's finally done! It's not available in Plasma 5.6 (from kubuntu 16.04 ppa), but kubuntu LTS users can use the archive.neon.kde.org repository to get shiny new plasma 5.8 where it works. (Note: upgrading kubuntu to KDE neon might break things, althought it did not for me.) – gluk47 Dec 11 '16 at 11:45
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.showInteractiveConsole 
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.