https://bugs.kde.org/show_bug.cgi?id=435081

            Bug ID: 435081
           Summary: [scripting] panels() also returns the desktops()
                    containments
           Product: plasmashell
           Version: master
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: k...@davidedmundson.co.uk
          Reporter: zrenf...@gmail.com
                CC: plasma-b...@kde.org
  Target Milestone: 1.0

While fixing a plasma scripting example in the documentation, I noticed that my
desktop widget's config keys was being logged twice. I had added a digitalclock
widget to my desktop to test quickly.

My Code: https://gist.github.com/Zren/e1a1c1a851a3fa76216d056b8f95c144

Notice I iterate the widgets in desktops() first, then panels() after. The
output of the code is:

        desktops()
        org.kde.plasma.folder[35] com.github.zren.sysmongraphs[93]:
        org.kde.plasma.folder[35] com.github.zren.commandoutput[95]:
        org.kde.plasma.folder[35] org.kde.plasma.digitalclock[99]:
        org.kde.plasma.digitalclock: 
                Appearance: 
                        showDate: true
        panels()
        org.kde.panel[1] org.kde.plasma.pager[3]:
        org.kde.panel[1] org.kde.plasma.systemtray[7]:
        org.kde.panel[1] org.kde.plasma.win7showdesktop[46]:
        org.kde.panel[1] org.kde.plasma.taskmanager[47]:
        ...
        org.kde.plasma.folder[35] com.github.zren.sysmongraphs[93]:
        org.kde.plasma.folder[35] com.github.zren.commandoutput[95]:
        org.kde.plasma.folder[35] org.kde.plasma.digitalclock[99]:
        org.kde.plasma.digitalclock: 
                Appearance: 
                        showDate: true


After skimming my code, I moved onto the scriptengine_v1.cpp code and found
that while the desktops() function filters by !isPanel(), the panels() function
does not.

https://invent.kde.org/plasma/plasma-workspace/-/blame/master/shell/scripting/scriptengine_v1.cpp#L470

It was filtering by isPanel() before port to QJSEngine:

https://invent.kde.org/plasma/plasma-workspace/-/commit/033ad5ca60b3d4250a4f354fa38fc60f7d97c78b#cbf01be30b27864a9b58f834c520a69d108a4888_467_469

Since I've confirmed this bug is a regression, I'll try to send a MR soon.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to