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

            Bug ID: 485718
           Summary: KWin JS scripting api missing workspace and other
                    globals
    Classification: Plasma
           Product: kwin
           Version: 6.0.4
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: scripting
          Assignee: kwin-bugs-n...@kde.org
          Reporter: olafur.palss...@gmail.com
  Target Milestone: ---

SUMMARY

Behavior of KWin scripts when using `plasma-interactiveconsole`. Missing
globals when running commands. I found this when trying to fix a script I had
working on Plasma 5 and decided to debug it with `plasma-interactiveconsole`.

I can't confirm the reason my script isn't working when packaged and loaded
into Plasma but the behavior since both don't work (JS Error in
`plasma-interactiveconsole` and nothing observed when loaded into plasma).

I can't find workspace either on `this` context or as a global as shown with
script below.



STEPS TO REPRODUCE
1. Open `plasma-interactiveconsole`
2. Run the following script
```
for (let key in this) // expected 'registerShortcut' and 'workspace' to be keys
here
    print(key + ' - ' + this[key] + '\n')
print('\n')
print('\n')

for (let key in __AppInterface)
    print(key + ' - ' + this[key] + '\n')
print('\n')
print('\n')

print('registerShortcut: ' + typeof registerShortcut + '\n') // expected
function here
print('workspace: ' + typeof workspace + '\n') // expected some object with
properties here
```

OBSERVED RESULT

__AppInterface - WorkspaceScripting::AppInterface(0x56d3925a4340)
screenGeometry - function() { [native code] }
lockCorona - function() { [native code] }
sleep - function() { [native code] }
print - function() { [native code] }
getApiVersion - function() { [native code] }
__newPanel - function() { [native code] }
__newConfigFile - function() { [native code] }
ConfigFile - function ConfigFile() { [native code] }
Panel - function Panel() { [native code] }
QRectF - function QRectF() { [native code] }
createActivity - function() { [native code] }
setCurrentActivity - function() { [native code] }
currentActivity - function() { [native code] }
activities - function() { [native code] }
activityName - function() { [native code] }
setActivityName - function() { [native code] }
loadSerializedLayout - function() { [native code] }
desktopsForActivity - function() { [native code] }
desktops - function() { [native code] }
desktopById - function() { [native code] }
desktopForScreen - function() { [native code] }
screenForConnector - function() { [native code] }
panelById - function() { [native code] }
panels - function() { [native code] }
fileExists - function() { [native code] }
loadTemplate - function() { [native code] }
applicationExists - function() { [native code] }
defaultApplication - function() { [native code] }
userDataPath - function() { [native code] }
applicationPath - function() { [native code] }
knownWallpaperPlugins - function() { [native code] }
gridUnit - 18
setImmutability - function() { [native code] }
immutability - function() { [native code] }
i18n - function() { [native code] }
i18nc - function() { [native code] }
i18np - function() { [native code] }
i18ncp - function() { [native code] }
i18nd - function() { [native code] }
i18ndc - function() { [native code] }
i18ndp - function() { [native code] }
i18ndcp - function() { [native code] }
xi18n - function() { [native code] }
xi18nc - function() { [native code] }
xi18np - function() { [native code] }
xi18ncp - function() { [native code] }
xi18nd - function() { [native code] }
xi18ndc - function() { [native code] }
xi18ndp - function() { [native code] }
xi18ndcp - function() { [native code] }
locked - false
hasBattery - true
screenCount - 3
activityIds -
1,2,36,61,120,155,156,157,158,159,160,161,162,163,164,165,166,167,168,171,172,173,174,175,176,177,178,179,180,181,190
panelIds - 26,113,182
knownPanelTypes - org.kde.panel
knownActivityTypes - org.kde.desktopcontainment,org.kde.plasma.folder
knownWidgetTypes -
org.kde.plasma.simplekickoff,com.himdek.kde.plasma.overview,com.github.boraerciyas.controlcentre,org.kde.plasma.pager,org.kde.plasma.activitypager,org.kde.plasma.trash,org.kde.plasma.systemmonitor.diskactivity,org.kde.plasma.activitybar,org.kde.plasma.kickerdash,org.kde.plasma.systemmonitor.memory,org.kde.plasma.webbrowser,org.kde.plasma.private.grouping,org.kde.plasma.icontasks,org.kde.plasma.printmanager,org.kde.plasma.diskquota,org.kde.plasma.analogclock,org.kde.plasma.systemmonitor.net,org.kde.plasma.kicker,org.kde.plasma.userswitcher,org.kde.plasma.cameraindicator,org.kde.plasma.keyboardindicator,org.kde.panel,org.kde.plasma.systemmonitor.cpucore,org.kde.plasma.brightness,org.kde.desktopcontainment,org.kde.plasma.quicklaunch,org.kde.plasma.marginsseparator,org.kde.plasma.addons.katesessions,org.kde.plasma.fifteenpuzzle,org.kde.plasma.icon,org.kde.plasma.networkmanagement,org.kde.plasma.keyboardlayout,org.kde.plasma.showdesktop,org.kde.plasma.folder,org.kde.kscreen,org.kde.plasma.showActivityManager,org.kde.plasma.panelspacer,org.kde.plasma.weather,org.kde.plasma.lock_logout,org.kde.plasma.notes,org.kde.plasma.comic,org.kde.plasma.konsoleprofiles,org.kde.plasma.colorpicker,org.kde.plasma.kimpanel,org.kde.plasma.devicenotifier,org.kde.plasma.private.systemtray,org.kde.plasma.fuzzyclock,org.kde.plasma.mediaframe,org.kde.plasma.battery,org.kde.plasma.timer,org.kde.plasma.binaryclock,org.kde.plasma.notifications,org.kde.milou,org.kde.plasma.grouping,org.kde.plasma.minimizeall,org.kde.plasma.systemmonitor,org.kde.plasma.kickoff,org.kde.plasma.calendar,org.kde.plasma.volume,org.kde.plasma.clipboard,org.kde.plasma.systemtray,org.kde.plasma.calculator,org.kde.plasma.mediacontroller,org.kde.plasma.manage-inputmethod,org.kde.plasma_applet_dict,org.kde.plasma.bluetooth,org.kde.plasma.digitalclock,org.kde.plasma.systemmonitor.cpu,org.kde.plasma.taskmanager,org.kde.plasma.appmenu,org.kde.kdeconnect,org.kde.plasma.vault,org.kde.plasma.systemmonitor.diskusage,org.kde.plasma.windowlist
theme - Gently
applicationVersion - 6.0.3
platformVersion - 
scriptingVersion - 20
multihead - false
multiheadScreen - false
locale - en_US
language - English
languageId - en


objectName - undefined
locked - false
hasBattery - true
screenCount - 3
activityIds -
1,2,36,61,120,155,156,157,158,159,160,161,162,163,164,165,166,167,168,171,172,173,174,175,176,177,178,179,180,181,190
panelIds - 26,113,182
knownPanelTypes - org.kde.panel
knownActivityTypes - org.kde.desktopcontainment,org.kde.plasma.folder
knownWidgetTypes -
org.kde.plasma.simplekickoff,com.himdek.kde.plasma.overview,com.github.boraerciyas.controlcentre,org.kde.plasma.pager,org.kde.plasma.activitypager,org.kde.plasma.trash,org.kde.plasma.systemmonitor.diskactivity,org.kde.plasma.activitybar,org.kde.plasma.kickerdash,org.kde.plasma.systemmonitor.memory,org.kde.plasma.webbrowser,org.kde.plasma.private.grouping,org.kde.plasma.icontasks,org.kde.plasma.printmanager,org.kde.plasma.diskquota,org.kde.plasma.analogclock,org.kde.plasma.systemmonitor.net,org.kde.plasma.kicker,org.kde.plasma.userswitcher,org.kde.plasma.cameraindicator,org.kde.plasma.keyboardindicator,org.kde.panel,org.kde.plasma.systemmonitor.cpucore,org.kde.plasma.brightness,org.kde.desktopcontainment,org.kde.plasma.quicklaunch,org.kde.plasma.marginsseparator,org.kde.plasma.addons.katesessions,org.kde.plasma.fifteenpuzzle,org.kde.plasma.icon,org.kde.plasma.networkmanagement,org.kde.plasma.keyboardlayout,org.kde.plasma.showdesktop,org.kde.plasma.folder,org.kde.kscreen,org.kde.plasma.showActivityManager,org.kde.plasma.panelspacer,org.kde.plasma.weather,org.kde.plasma.lock_logout,org.kde.plasma.notes,org.kde.plasma.comic,org.kde.plasma.konsoleprofiles,org.kde.plasma.colorpicker,org.kde.plasma.kimpanel,org.kde.plasma.devicenotifier,org.kde.plasma.private.systemtray,org.kde.plasma.fuzzyclock,org.kde.plasma.mediaframe,org.kde.plasma.battery,org.kde.plasma.timer,org.kde.plasma.binaryclock,org.kde.plasma.notifications,org.kde.milou,org.kde.plasma.grouping,org.kde.plasma.minimizeall,org.kde.plasma.systemmonitor,org.kde.plasma.kickoff,org.kde.plasma.calendar,org.kde.plasma.volume,org.kde.plasma.clipboard,org.kde.plasma.systemtray,org.kde.plasma.calculator,org.kde.plasma.mediacontroller,org.kde.plasma.manage-inputmethod,org.kde.plasma_applet_dict,org.kde.plasma.bluetooth,org.kde.plasma.digitalclock,org.kde.plasma.systemmonitor.cpu,org.kde.plasma.taskmanager,org.kde.plasma.appmenu,org.kde.kdeconnect,org.kde.plasma.vault,org.kde.plasma.systemmonitor.diskusage,org.kde.plasma.windowlist
theme - Gently
applicationVersion - 6.0.3
platformVersion - 
scriptingVersion - 20
multihead - false
multiheadScreen - false
locale - en_US
language - English
languageId - en
objectNameChanged - undefined
print - function() { [native code] }
screenGeometry - function() { [native code] }
lockCorona - function() { [native code] }
sleep - function() { [native code] }


registerShortcut: undefined
workspace: undefined

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

Running `plasma-interactiveconsole --kwin` does nothing with the output
```
Executing script at fimmtudagur, 18. apríl 2024 08:40:29 GMT


Runtime: 1ms
```

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

Reply via email to