Closed djneba closed 7 months ago
Weird, I just verified that windows are opened on a second monitor.
What happens if you do the following:
Does this case work for you?
(Also, Wayland or X11?)
I did as you said. The script fills up the secondary screen, then moves on to next desktop (not screen). Once all the desktops are filled, it finally moves to the primary screen, but it only floats the windows. I am using Wayland. I tried this out on X11, too. No difference.
Interesting, so you have different behavior using the same code with the same settings (default)
Do you see any errors related to this script in your logs?
A suspicion, do your monitors happen to be identical?
Could you add the following code print('current <line number>', window.output.serialNumber)
to contents/component/desktop.mjs
before line 17
and 25
(so right before the returns) and substitute the <line number>
for numbers 17
and 25
respectively and repeat the 4 steps I layed out earlier and post the log result
I get this:
Apr 08 18:34:32 reborn kwin_wayland[20069]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
Apr 08 18:34:39 reborn kwin_wayland[20069]: qml: current 16 16843009
Apr 08 18:35:00 reborn kwin_wayland[20069]: qml: current 16 16843009
Apr 08 18:35:02 reborn kwin_wayland[20069]: qml: current 16 16843009
Apr 08 18:35:03 reborn kwin_wayland[20069]: qml: current 16 16843009
Apr 08 18:35:05 reborn kwin_wayland[20069]: qml: current 16 16843009
Apr 08 18:35:07 reborn kwin_wayland[20069]: qml: current 16 16843009
Apr 08 18:35:08 reborn kwin_wayland[20069]: qml: current 16 16843009
Apr 08 18:35:09 reborn kwin_wayland[20069]: qml: current 16 16843009
No other errors. My monitors are not identical. One is a TV.
Could you try to replace the add function with this version that logs more and post output of the 4 steps
function add(window, desktopId) {
print('ADDING', window.resourceName);
const serial = window.output.serialNumber;
if (!outputs.hasOwnProperty(serial)) outputs[serial] = Output();
if (outputs[serial].add(window, grid(desktopId, serial))) {
window.outputSerial = serial;
print('Added to current', window.output.serialNumber);
return window;
} else {
print('Trying any other screen', shared.workspace.screens.length);
for (const o of shared.workspace.screens) {
const serial = o.serialNumber;
print('next attempt', serial);
if (!outputs.hasOwnProperty(serial)) outputs[serial] = Output();
if (outputs[serial].add(window, grid(desktopId, serial))) {
window.outputSerial = serial;
shared.workspace.sendClientToScreen(window, o); // output is read only in api
return window;
}
}
}
// couldn't find any outputs with sufficient space to add window too
}
Apr 08 19:00:00 reborn kwin_wayland[25773]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
Apr 08 19:00:03 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:03 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:08 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:08 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:33 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:33 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:33 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:33 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:33 reborn kwin_wayland[25773]: kwin_screencast: Waiting for new buffers to be created
Apr 08 19:00:34 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:34 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: Trying any other screen 2
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: Trying any other screen 2
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:36 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:36 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:36 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:36 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:37 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:37 reborn kwin_wayland[25773]: qml: Added to current 16843009
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: Trying any other screen 2
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: Trying any other screen 2
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: Trying any other screen 2
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:38 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: ADDING konsole
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: Trying any other screen 2
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: next attempt 16843009
Apr 08 19:00:35 reborn kwin_wayland[25773]: qml: next attempt 16843009
Well there is the issue, both your screens seem to have the exact same serialNumber
. I assumed that property was unique for screens... That is quite some luck you have there owning 2 displays with the exact same serial number. I guess I'll have to find something else that makes them unique...
They are different devices. Both made by LG. One of them is a TV.
Here is some Wayland (I guess) info:
interface: 'zxdg_output_manager_v1', version: 3, name: 31
xdg_output_v1
output: 61
name: 'HDMI-A-1'
description: 'LG Electronics LG IPS FULLHD/16843009'
logical_x: 0, logical_y: 1080
logical_width: 1920, logical_height: 1080
xdg_output_v1
output: 60
name: 'DP-2'
description: 'LG Electronics LG TV/16843009'
logical_x: 0, logical_y: 0
logical_width: 1920, logical_height: 1080
The only difference is output:60 vs output:61. I don't know if this is usable.
You got the "luck" of them providing the exact same serial id for both devices. I adjusted the script to use the name of the display. I'll see if I can ask upstream if it is possible to provide a unique id to the scripting interface, because I'm afraid the name won't always be unique either in all cases.
Could you give the develop
branch a try. Let me know if it works then I'll merge it back into master. I gave it a quick test using a second monitor and it seemed to work for me, but I don't have a setup with 2 identical serial numbers.
So, I don't know how to say this. You fixed it. However, I have doubts if it'll work for other users. I guess my setup turned out to be somewhat problematic. I don't know how common this issue is. Right now with develop branch it works perfectly.
One more thing, you should upload this to store.kde.org. Polonium and a resurrected Krohnkite are there. They are not bad, but lack the features and stability of your script. I think this project could benefit if it had more users. Thank you. I don't see any donation links. Do you have any? Edit: found it. WIll donate in couple of days.
I don't know how common this issue is
Me neither but it seems the serial number is not unique. The name seems to be much more unique, so let's see how that goes and if that gives issues for others I'll make a different fix. https://bugs.kde.org/show_bug.cgi?id=485266
you should upload this to store.kde.org
I already did a long time ago, but for some reason it doesn't show up in the search window on Plasma so I kind of just gave up on that https://store.kde.org/p/1198671
features and stability of your script
Thank you
WIll donate in couple of days.
Thank you
And thank you for reporting this issue and helping me track it down by providing the logs
I have a dual screen setup. Primary (Screen 2) is below the secondary (Screen 1). This script only opens windows on the secondary screen. I am using Plasma 6.0.3.