Just tried, but didn't succeeded.
Maybe i didn't understood well what this script does.
Not only the panel from the left screen went and stayed on the right one.
I've had a kwrite window on the left screen, but after turning the screen "off" and "on" again, the kwrite window went to the right screen as well and stayed there as well.
Without the script, after re-enabling the left screen, all of the windows (but the panels) went to the left screen.
This is pretty mcuh what the script does and "it's complicated"
tl; dr:
with the script, windows are supposed to stay on the primary or secondary screen.
See bug #286146
KWin does only ensure the windows remain visible but it doesn't stick them to a screen.
So if you add a screen on the left, windows from the other screen would "move" there (actually they they where they are in global coordinates, but the 0,0 corner moved from the right screen to the left) and there's request to stop that and keep the windows on the right screen.
That's however not all. The dominant screen layout thinks of "primary" and "secondary" rather than "left" and "right", so if you remove the primary screen, the secondary will become the primary and all windows moved there. If you then re-add the primary screen, the seconary screen becomes the secondary screen and the windows would (by the script) move from the former primary screen (the actual secondary one) to the new (and actual) primary screen.
Eg. just changing the primary screen would swap windows.
What you describe (remove,re-add) is kinda special case and not handled.
The KWin core will maintain the former geometry of windows that have "not been touched" (ie. moved or resized by the user)
This was added mostly to deal with window resizes due to screen resolution changes (gameplay case)
I've a panel on the left screen (call it 1), and one on the right (call it 2).
Whan i disable the left screen, 1 goes to the right screen, when i enable the left screen again, 1 stays on the rightmost screen.
Panels are windows.
Is there a way to manage them?
Thanks
if (clients[i].specialWindow || clients[i].noBorder) {
// ignore docks etc. as well as undecorated but keep tool- and utility windows
I explicitly skipped them since stuff like desktop, docks or yakuake usually fixes themselve on screen changes (in a "better" way than a generic handling could be)
I guess i could add a whitelist matching the window class (what's the output of "xprop WM_CLASS" on the panel - plasma panels should follow the desktop)
I'll try to change the code by myself, thanks for pointing out.
However, what i was trying to do was a workaround for a long standing bug:
https://bugs.kde.org/show_bug.cgi?id=293453
Hehe - i had absolute panel lengths in be::shell for ~10 minutes before figuring that it would be a stupid idea.
That bug could partially be worked around by a kwin script but is absolutely not subject to this one (which doesn't change window sizes to begin with)
However, it would be much better to fix the bug (to avoid nasty heuristics; the script would have to guess the orientation of the panel, as you want to adjust the length, but not the thickness)
I've a panel on the left screen (call it 1), and one on the right (call it 2).
Whan i disable the right screen, 1 goes to the right screen, when i enable the right panel again, 1 stays on the right screen.
Panels are is a windows. Is there a way to manage them?
Thanks
Ratings & Comments
9 Comments
8 8 great It really helps a great deal when the screens turn on after suspending (DPMS)
Just tried, but didn't succeeded. Maybe i didn't understood well what this script does. Not only the panel from the left screen went and stayed on the right one. I've had a kwrite window on the left screen, but after turning the screen "off" and "on" again, the kwrite window went to the right screen as well and stayed there as well. Without the script, after re-enabling the left screen, all of the windows (but the panels) went to the left screen.
This is pretty mcuh what the script does and "it's complicated" tl; dr: with the script, windows are supposed to stay on the primary or secondary screen. See bug #286146 KWin does only ensure the windows remain visible but it doesn't stick them to a screen. So if you add a screen on the left, windows from the other screen would "move" there (actually they they where they are in global coordinates, but the 0,0 corner moved from the right screen to the left) and there's request to stop that and keep the windows on the right screen. That's however not all. The dominant screen layout thinks of "primary" and "secondary" rather than "left" and "right", so if you remove the primary screen, the secondary will become the primary and all windows moved there. If you then re-add the primary screen, the seconary screen becomes the secondary screen and the windows would (by the script) move from the former primary screen (the actual secondary one) to the new (and actual) primary screen. Eg. just changing the primary screen would swap windows. What you describe (remove,re-add) is kinda special case and not handled. The KWin core will maintain the former geometry of windows that have "not been touched" (ie. moved or resized by the user) This was added mostly to deal with window resizes due to screen resolution changes (gameplay case)
I've a panel on the left screen (call it 1), and one on the right (call it 2). Whan i disable the left screen, 1 goes to the right screen, when i enable the left screen again, 1 stays on the rightmost screen. Panels are windows. Is there a way to manage them? Thanks
if (clients[i].specialWindow || clients[i].noBorder) { // ignore docks etc. as well as undecorated but keep tool- and utility windows I explicitly skipped them since stuff like desktop, docks or yakuake usually fixes themselve on screen changes (in a "better" way than a generic handling could be) I guess i could add a whitelist matching the window class (what's the output of "xprop WM_CLASS" on the panel - plasma panels should follow the desktop)
I'll try to change the code by myself, thanks for pointing out. However, what i was trying to do was a workaround for a long standing bug: https://bugs.kde.org/show_bug.cgi?id=293453
Hehe - i had absolute panel lengths in be::shell for ~10 minutes before figuring that it would be a stupid idea. That bug could partially be worked around by a kwin script but is absolutely not subject to this one (which doesn't change window sizes to begin with) However, it would be much better to fix the bug (to avoid nasty heuristics; the script would have to guess the orientation of the panel, as you want to adjust the length, but not the thickness)
xprop report this: WM_STATE(WM_STATE): WM_WINDOW_ROLE(STRING) = "panel_2" WM_CLIENT_LEADER(WINDOW): window id # 0x1c00009 WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST WM_NAME(STRING) = "plasma-desktop" WM_LOCALE_NAME(STRING) = "it_IT.UTF-8" WM_CLASS(STRING) = "Plasma", "Plasma" WM_HINTS(WM_HINTS): WM_NORMAL_HINTS(WM_SIZE_HINTS): WM_CLIENT_MACHINE(STRING) = "Gozer" WM_COMMAND(STRING) = { "/usr/bin/plasma-desktop" }
I've a panel on the left screen (call it 1), and one on the right (call it 2). Whan i disable the right screen, 1 goes to the right screen, when i enable the right panel again, 1 stays on the right screen. Panels are is a windows. Is there a way to manage them? Thanks