Bug 380347 - qdbus can't access plasma scripting when widgets are locked
Summary: qdbus can't access plasma scripting when widgets are locked
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (other bugs)
Version First Reported In: master
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-30 07:38 UTC by Oded Arbel
Modified: 2018-03-25 17:22 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oded Arbel 2017-05-30 07:38:21 UTC
As described here: https://bugs.kde.org/show_bug.cgi?id=217950#c47 , the D-Bus interface org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript always returns an error if the plasma shell is in "locked widgets" mode.

Running the same script from the plasma interactive shell console still works, even if the widgets are locked.

Example:

$ qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var test=1;'
Error: org.freedesktop.DBus.Error.Failed
Widgets are locked
Comment 1 David Edmundson 2018-03-12 10:03:12 UTC
Code goes out of it's way to explicitly check, it's not a code bug.

Whether the design choice is sensible is another question. There's not much rationale at the time: 
https://git.reviewboard.kde.org/r/125648/

What did you want it for?
Comment 2 Oded Arbel 2018-03-12 16:00:10 UTC
(In reply to David Edmundson from comment #1)
> What did you want it for?

Exactly the reason stated in the change request linked in my first commit - set the wallpaper from an application. 

If this is the stated reason, I don't understand why not enable it when widgets are locked - so I may only script plasma if I'm willing to have my widgets more all over the place?
Comment 3 David Edmundson 2018-03-16 02:51:21 UTC
>so I may only script plasma if I'm willing to have my widgets more all over the place?

They don't move all over the place. The handles on mouseover is something that disappeared years ago. 

You can only edit things if the user has set you can edit things... which has some sane rationale. 

I'll make a patch and put it on review and see what happens.
Comment 4 David Edmundson 2018-03-20 16:29:39 UTC
Git commit ddf452b6774f481ced47f9551e4a961622194646 by David Edmundson.
Committed on 20/03/2018 at 16:26.
Pushed by davidedmundson into branch 'master'.

Don't block evaluating DBus scripts if widgets are locked.

Summary:
Original decision didn't really have a rationale:
https://git.reviewboard.kde.org/r/125648/

It's causing bugs in people doing somewhat sensible things.

If widgets are locked, the script will still fail when it tries to do
something it can't.

Reviewers: #plasma, broulik

Subscribers: mart, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D11375

M  +1    -1    shell/shellcorona.cpp

https://commits.kde.org/plasma-workspace/ddf452b6774f481ced47f9551e4a961622194646
Comment 5 Josep Febrer 2018-03-25 17:22:04 UTC
With this patch I can no longer change the wallpaper via qdbus with or without the widgets locked.

Even with the widgets unlocked, I get this result:

qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file:/home/user/wallpaper.jpg")}'
Error: org.freedesktop.DBus.Error.Failed
Widgets are locked

I think that the logic in the patch it's wrong.
I modified in shell/shellcorona.cpp

if (immutability() != Plasma::Types::SystemImmutable) {

for 

if (immutability() == Plasma::Types::SystemImmutable) {

And then it works as intended I can change the wallpaper via qdbus with the widgets locked and unlocked.