[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 Michael Weghorn changed: What|Removed |Added CC||m.wegh...@posteo.de -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 David Edmundson changed: What|Removed |Added CC||ad.liu@gmail.com --- Comment #14 from David Edmundson --- *** Bug 477069 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 Dmitry Alexandrov changed: What|Removed |Added CC||d...@gnui.org -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #13 from Yuxin Wu --- Created attachment 130595 --> https://bugs.kde.org/attachment.cgi?id=130595&action=edit screenshot of Bustle When I run bustle it seems to show kwin side is incorrect. I put the following code into the scripting console: ``` print(workspace.numScreens); print(workspace.workspaceWidth); print(workspace.workspaceWidth+1); print(workspace.workspaceWidth+2); print(workspace.workspaceWidth+3); print(workspace.workspaceWidth+4); ``` and launch kwin under the environment `QDBUS_DEBUG=1 QT_LOGGING_RULES="kwin_scripting.debug=true"`. When I click "execute" in the scripting console, I saw this in the output of kwin: ``` QDBusConnectionPrivate(0x7f67fc00f8c0) got message (signal): QDBusMessage(type=MethodCall, service=":1.2859", path="/Scripting", interface="", member="loadScript", signature="s", contents=("/home/ USER/.local/share/plasmashell/interactiveconsoleautosave.js") ) QDBusConnectionPrivate(0x7f67fc00f8c0) Automatically sending reply: (QVariant(int, 2)) QDBusConnectionPrivate(0x7f67fc00f8c0) sending message (no reply): QDBusMessage(type=MethodReturn, service="", signature="", contents=(2) ) QDBusConnectionPrivate(0x7f67fc00f8c0) got message (signal): QDBusMessage(type=MethodCall, service=":1.2859", path="/2", interface="", member="run", signature="", contents=() ) kwin_scripting: "/home/USER/.local/share/plasmashell/interactiveconsoleautosave.js" : "2" kwin_scripting: "/home/USER/.local/share/plasmashell/interactiveconsoleautosave.js" : "13440" kwin_scripting: "/home/USER/.local/share/plasmashell/interactiveconsoleautosave.js" : "13441" kwin_scripting: "/home/USER/.local/share/plasmashell/interactiveconsoleautosave.js" : "13442" QThread(ptr=0x7f6811979060, name=QDBusConnectionManager) emitting signal at "/2" kwin_scripting: "/home/USER/.local/share/plasmashell/interactiveconsoleautosave.js" : "13443" kwin_scripting: "/home/USER/.local/share/plasmashell/interactiveconsoleautosave.js" : "13444" QThread(ptr=0x7f6811979060, name=QDBusConnectionManager) emitting signal at "/2" QDBusConnectionPrivate(0x7f67fc00f8c0) sending message (no reply): QDBusMessage(type=MethodReturn, service="", signature="", contents=() ) QThread(ptr=0x7f6811979060, name=QDBusConnectionManager) emitting signal at "/2" ``` According to the output, 6 messages are printed, but only 3 signals are sent (this bug occasionally happens, but not always). In the scripting console, I only observed the first 3 lines of output. In Bustle, I only observed 3 signals (see attachment). -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #12 from David Edmundson --- Indeed, reproduced occasionally. >From what I understand of the bug a port to using an adaptor will fix this as then it won't need to scan our metaObject so to emit the signal from the DBus thread which might be behind our main thread. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 David Edmundson changed: What|Removed |Added CC||k...@davidedmundson.co.uk --- Comment #11 from David Edmundson --- Running bustle it seems the kwin side is correct. We get the print signal emitted twice before run returns. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 Yuxin Wu changed: What|Removed |Added Ever confirmed|0 |1 Status|REPORTED|CONFIRMED -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 Yuxin Wu changed: What|Removed |Added CC||ppwwyy...@gmail.com --- Comment #10 from Yuxin Wu --- I run into the same bug. By launching kwin under: ``` QDBUS_DEBUG=1 QT_LOGGING_RULES="kwin_scripting.debug=true" ``` I can see that the missing logs are printed by kwin, but was not sent through dbus -- occasionally only some of the messages are sent through dbus. After adding a sleep statement before `emit print(message);` in `scripting.cpp`, all messages can be sent normally. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #9 from Sigma --- KDebugSettings is an application to configure logging for KDE applications ( https://community.kde.org/KDevelop/Debugging is the only documentation I was able to find). Increase the level for "KWin Scripting" (I am using "all") to make KWin log the print()s. I am viewing the log output by restarting KWin from Konsole using "kwin_x11 --replace". -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #8 from LinG --- Ah okay, so it seems to be purely a console thing. Btw I've only ever used the "wm console" to write my kwin scripts, could you explain to me how to use and set this "KDebugSettings" variable? That would make my kwin scripting a lot easier for now as long as this bug exists. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #7 from Sigma --- print("hi") print("hihi") prints "Hi" in the scripting console and "hi\nhihihi" to KWin's stdout if you enable debug output in KDebugSettings. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #6 from Sigma --- I noticed that workspace was missing after my comment and went to test a few things. The missing print outputs also seem to be a scripting console bug because all messages are printed in KWin's console output. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #5 from LinG --- you can test that you are not on "kwin" because you can't use the global `workspace` for example if you try this, when you first open the console: print(workspace.desktopGridWidth); but if you switch to "plasma" and back to "kwin" then you access to these globals. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #4 from LinG --- That's because of a different bug (which I should probably report as well...). But if you open "WM console" it shows the default state as "kwin" but it's actually on "plasma" because you don't have access to some of the kwin globals. You need to manually switch to "plasma" and then back to "kwin" to actually be able to run the script as a kwin script. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #3 from Sigma --- Interesting, I can reproduce this on my KDE 5.12.5, but this happens only if I switch between the KWin and Plasma "modes". It works if I leave it at KWin (the default). -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 --- Comment #2 from LinG --- just javascript, everything works fine when I only use the print() method once. But when I start to use the print() method multiple times in quick succession then it won't print() some of the print() methods. When I use the "plasma" option to execute the script it will print both but when I use the "kwin" option it will skip some print() statements. It seems to depend on how long kwin is busy with executing the commands between the consecutive print statements. for example, if I put a long loop between the two print() statements then both will execute, like this example: print('hi'); var a = 0; for (var i = 0 ; i < 1000; i++) { a += i; } print('hihi'); but doing only: print('hi'); print('hihi'); seems to be too fast and kwin will not print the second statement to console. -- You are receiving this mail because: You are watching all bug changes.
[kwin] [Bug 392840] Can't seem to use print() multiple times
https://bugs.kde.org/show_bug.cgi?id=392840 lord_si...@live.de changed: What|Removed |Added CC||lord_si...@live.de --- Comment #1 from lord_si...@live.de --- I am not a KDE developer, but this works for me, are you using JavaScript or QML for your script. And did you add the second print command after you ran your script with only the first print? -- You are receiving this mail because: You are watching all bug changes.