Summary: | kwin interactive console does not work | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Know Zero <knowzero> |
Component: | scripting | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | ASSIGNED --- | ||
Severity: | normal | CC: | 4wy78uwh, andy, ashark, info, kde, kdebugs, ken, kmcwilliampublic, m.weghorn, natalie_clarius, nate, postix, ppwwyyxxc, v, zawertun, zrenfire |
Priority: | NOR | ||
Version: | 5.27.5 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
See Also: | https://bugs.kde.org/show_bug.cgi?id=477069 | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | The not bold timedate text at first launch |
Description
Know Zero
2021-11-06 04:28:12 UTC
Can confirm. I just switched to Plasma from Gnome after they broke my workflow AGAIN(!!!) with the latest update. I am trying to port my GJS scripts to KWin and just ran into this. Oops :-( (In reply to qq6fHY79E45suV from comment #2) > I just switched to Plasma from Gnome after they broke my workflow AGAIN(!!!) > with the latest update. I am trying to port my GJS scripts to KWin and just > ran into this. Oops :-( I just noticed the platform the bug is registered under. I'm using the latest Neon. I just noticed in OpenSUSE Tumbleweed (kwin 5.23.5) that the kwin print output and errors are printed to the system journal. Use: journalctl -b0 -f This `journalctl -b0 -f` cannot print the output from script in interactive console, right? (In reply to Andrew Shark from comment #5) > This `journalctl -b0 -f` cannot print the output from script in interactive > console, right? Yes, it can. But that output contains a lot of other stuff to. A more specific command to retreive output from JavaScript-based KWin and Plasmshell scripting is: > journalctl -g "js:" -f Hmm, it just plainly does not work for me. The latter command is just silent. The script in interactive console is just `print("Hello")`. What else I can check? I am on Arch Linux if that matters. I see the same result (no output) in the post https://www.reddit.com/r/kde/comments/qo1jtj/kwin_scripting_console_not_working/. The systemd logs printed in journalctl is just capturing the kwin_x11 output. It's possible that your distro doesn't capture the terminal output, or kwin restarted somehow. The journalctl workaround works fine for me OpenSUSE Tumbleweed Plasma 5.24.5. Another workaround is to open Konsole, and run the following to restart kwin and log it's output to the Konsole window. kstart5 -- kwin_x11 --replace `kwin_x11 --replace` is the actual command, but `kstart5` will keep kwin running after you close Konsole. The `--` tells kstart5 to treat everything after it as a single argument (the command to run). (In reply to Andrew Shark from comment #7) > Hmm, it just plainly does not work for me. The latter command is just > silent. The script in interactive console is just `print("Hello")`. What > else I can check? I am on Arch Linux if that matters. I see the same result > (no output) in the post > https://www.reddit.com/r/kde/comments/qo1jtj/ > kwin_scripting_console_not_working/. Are you on Wayland? Then logging might not work. Consider using systemd boot: https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot Also make sure that you have logging for KWin scripts enabled:
> export QT_LOGGING_RULES='js=true; kwin_scripting=true'
Wow, that worked now. Without QT_LOGGING_RULES. I can now see `... kwin_wayland[994]: js: Hello` messages in journal. Thank you very much! For google searchers. I looked here https://wiki.archlinux.org/title/KDE#systemd_startup and to ensure you have enabled systemd startup, use `systemctl --user status plasma-plasmashell.service`. If it is active, it is working. It is also possible to use "console.info" if you are too lazy to modify environment variables and re-login, like me. A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3042 I also noticed that at first run, the datetime is not bold (expected: bold as all other launches). Created attachment 160274 [details]
The not bold timedate text at first launch
I can confirm what @hexchain says, `console.info` works - for me nothing else was producing output at all, but this finally did. It took me a while to figure out that "console.info" in comment 13 was meant to be used instead of "print" in the scripts... That does indeed work. The workaround isn't super reliable working with the journal. Almost always the output is in the journal immediately after the dbus calls, but occasionally I find it's delayed by some milliseconds. So you have to poll or retry. A bigger issue is you can't have multiple scripts running in parallel since it's this global journal output. You'd have to add some tag to each print statement to make sure you grep output from the right script only. |