Bug 489604 - Some windows automatically switching screens on unlock!
Summary: Some windows automatically switching screens on unlock!
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (show other bugs)
Version: 6.1.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-02 13:36 UTC by Vinay V
Modified: 2024-09-18 15:58 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Output of "kscreen-doctor -o" command (1.77 KB, text/plain)
2024-07-03 04:23 UTC, Vinay V
Details
"kscreen-doctor -o" output (1.28 KB, text/plain)
2024-07-03 04:28 UTC, Vinay V
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vinay V 2024-07-02 13:36:09 UTC
SUMMARY
Some windows automatically switching screens on unlock! 

I am using latest version of KDE (I think it is 6.1.1) on Garuda Linux (which is almost the same as Archlinux).

I have an external monitor connected to my laptop. The monitor is labelled as primary display and the laptop as secondary display. Generally, when I log back in from lock screen, my window placements go haywire. That is, many windows which are open in primary screen (monitor) will be moved to secondary (laptop screen) and will be maximised. This happens specifically for Dolphin, Konsole, KTorrent, Kate. Maybe others too, but I’ve observed these. Other windows like Chromium, VSCode, etc do not have this issue.
This does not happen always, but whenever I'm away from my desktop for longer (longer than 10-15 minutes). If I lock my desktop and unlock within a short period, everything is fine.

I am running on Wayland with support for XWayland. Is it possible that this issue is happening for windows that run on Wayland and not XWayland?


STEPS TO REPRODUCE
1. Have multiple displays (external monitor connected to laptop). In my case, the external monitor is primary display and laptop screen secondary.
2. Open multiple applications, some that run on Wayland and X11 apps. In my case, I have several Chromium windows, VSCode, Dolphin, Konsole, Kate, KTorrent, etc. Open them in primary display (external monitor).
3. Lock the desktop.
4. Unlock the desktop after 15-20 minutes or even better resume from sleep and unlock the desktop.

OBSERVED RESULT
Some windows - Dolphin, Kate, KTorrent, Konsole, etc have moved to secondary display (laptop screen) and are maximised (even though some were not maximised earlier). 
Other windows like Chromium, VSCode, etc are right where I left them.

EXPECTED RESULT
All windows should be in the same position, i.e., same screen, same virtual desktop and same location where it was present before the machine was locked or put to sleep.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux (Garuda Linux, specifically)
(available in About System)
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0 
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Operating System: Garuda Linux 
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Kernel Version: 6.9.6-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx
Memory: 9.7 GiB of RAM
Graphics Processor: AMD Radeon Vega 8 Graphics
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: VivoBook_ASUSLaptop X509DA_M509DA
System Version: 1.0
Comment 1 Zamundaaa 2024-07-02 21:29:36 UTC
Please attach the output of kscreen-doctor -o
Comment 2 Vinay V 2024-07-03 04:23:40 UTC
Created attachment 171316 [details]
Output of "kscreen-doctor -o" command

I have attached the output of "kscreen-doctor -o".
Do let me know if anything is required
Comment 3 Vinay V 2024-07-03 04:28:56 UTC
Created attachment 171317 [details]
"kscreen-doctor -o" output

Attaching again since the previous file format was bad
Comment 4 Vinay V 2024-07-05 04:28:38 UTC
(In reply to Zamundaaa from comment #1)
> Please attach the output of kscreen-doctor -o

I have attached the output. Please let me know if you need anything else
Comment 5 Vinay V 2024-07-09 09:20:04 UTC
(In reply to Vinay V from comment #0)
> SUMMARY
> Some windows automatically switching screens on unlock! 
> 
> I am using latest version of KDE (I think it is 6.1.1) on Garuda Linux
> (which is almost the same as Archlinux).
> 
> I have an external monitor connected to my laptop. The monitor is labelled
> as primary display and the laptop as secondary display. Generally, when I
> log back in from lock screen, my window placements go haywire. That is, many
> windows which are open in primary screen (monitor) will be moved to
> secondary (laptop screen) and will be maximised. This happens specifically
> for Dolphin, Konsole, KTorrent, Kate. Maybe others too, but I’ve observed
> these. Other windows like Chromium, VSCode, etc do not have this issue.
> This does not happen always, but whenever I'm away from my desktop for
> longer (longer than 10-15 minutes). If I lock my desktop and unlock within a
> short period, everything is fine.
> 
> I am running on Wayland with support for XWayland. Is it possible that this
> issue is happening for windows that run on Wayland and not XWayland?

I have narrowed it down to wayland being the problem. Windows of apps that run on X11/XWayland works fine. But wayland apps will frequently move to the second screen (laptop screen instead of external monitor) and will be maximised after coming back from lock screen (again, not immediately, but after a while of being locked).
I ran xlsclients command to determine which windows/apps were running on X11/Xwayland. I figured out Chromium was one such app. After I changed the flags to launch it with Wayland, Chromium also started behaving the same way! ALL Chromium windows would be moved from primary external display to secondary laptop screen and will be maximised!
Comment 6 Vinay V 2024-07-10 04:42:34 UTC
One more update. Today, I had not locked my screen, but left my desk unattended for 10 minutes. ALL the chromium windows (running on wayland) were automatically moved from external monitor (primary display) to my laptop display (secondary)!  
So, this happens not only when the machine is locked, but also when it is left unattended without locking. If the desktop is being used, then there is no problem.

Here are the journalctl logs for this period:

Jul 10 10:03:45 vinay-vivobook pipewire[5498]: ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for %f
Jul 10 10:03:45 vinay-vivobook pipewire[5498]: spa.alsa: 'plug:{SLAVE="a52:0,'hw:%f,3'"}': playback open failed: No such device
Jul 10 10:03:45 vinay-vivobook pipewire[5498]: mod.adapter: 0x630e73e75670: can't get format: No such device
Jul 10 10:03:45 vinay-vivobook pipewire[5498]: mod.adapter: usage: node.name=<string>
Jul 10 10:03:46 vinay-vivobook org_kde_powerdevil[13663]: Sleep event. connector=card1-eDP-1, dref not set
Jul 10 10:03:48 vinay-vivobook org_kde_powerdevil[13663]: Emitting DDCA_Display_Status_Event( 397674.412:  DDCA_EVENT_DPMS_ASLEEP, card1-eDP-1, dref: Display_Ref[NULL], io_path:/dev/i2c-6]
Jul 10 10:03:48 vinay-vivobook org_kde_powerdevil[13663]: Executed 1 registered callbacks.
Jul 10 10:03:48 vinay-vivobook org_kde_powerdevil[13663]: Emitting DDCA_Display_Status_Event( 397674.412:  DDCA_EVENT_DPMS_ASLEEP, card1-HDMI-A-1, dref: Display_Ref[bus /dev/i2c-5], io_path>
Jul 10 10:03:48 vinay-vivobook org_kde_powerdevil[13663]: Executed 1 registered callbacks.
Jul 10 10:03:53 vinay-vivobook systemd[1]: Starting autorandr execution hook...
Jul 10 10:03:53 vinay-vivobook autorandr[196229]: Authorization required, but no authorization protocol specified
Jul 10 10:03:53 vinay-vivobook autorandr[196229]: Can't open display :0
Jul 10 10:03:53 vinay-vivobook autorandr[196228]: Failed to run xrandr (line 626)
Jul 10 10:03:53 vinay-vivobook autorandr[196228]: autorandr running as user vinay (started from batch instance)
Jul 10 10:03:53 vinay-vivobook autorandr[196209]: Running autorandr as vinay for display :0
Jul 10 10:03:53 vinay-vivobook systemd[1]: autorandr.service: Deactivated successfully.
Jul 10 10:03:53 vinay-vivobook systemd[1]: Finished autorandr execution hook.
......
......
Jul 10 10:03:53 vinay-vivobook systemd[1]: Started dbus-:1.3-org.kde.powerdevil.backlighthelper@64.service.
Jul 10 10:03:53 vinay-vivobook plasmashell[13601]: kf.svg: findInCache with a lastModified timestamp of 0 is deprecated
Jul 10 10:03:53 vinay-vivobook plasmashell[13601]: kf.svg: findInCache with a lastModified timestamp of 0 is deprecated
Jul 10 10:03:53 vinay-vivobook plasmashell[13601]: kf.svg: findInCache with a lastModified timestamp of 0 is deprecated
Jul 10 10:03:53 vinay-vivobook systemd[1]: Starting autorandr execution hook...
Jul 10 10:03:54 vinay-vivobook org_kde_powerdevil[13663]: Sleep event. connector=card1-eDP-1, dref not set
Jul 10 10:03:54 vinay-vivobook wireplumber[5502]: wplua: [string "alsa.lua"]:182: attempt to concatenate a nil value (local 'node_name')
stack traceback:
[string "alsa.lua"]:182: in function <[string "alsa.lua"]:175>
Jul 10 10:03:54 vinay-vivobook autorandr[196277]: Authorization required, but no authorization protocol specified
Jul 10 10:03:54 vinay-vivobook autorandr[196277]: Can't open display :0
Jul 10 10:03:54 vinay-vivobook autorandr[196264]: Failed to run xrandr (line 626)
Jul 10 10:03:54 vinay-vivobook autorandr[196264]: autorandr running as user vinay (started from batch instance)
......
......
Jul 10 10:03:54 vinay-vivobook plasmashell[13601]: qt.qpa.wayland: eglSwapBuffers failed with 0x300d, surface: 0x0
Jul 10 10:03:54 vinay-vivobook autorandr[196255]: Running autorandr as vinay for display :0
Jul 10 10:03:54 vinay-vivobook systemd[1]: autorandr.service: Deactivated successfully.
Jul 10 10:03:54 vinay-vivobook systemd[1]: Finished autorandr execution hook.
Jul 10 10:03:54 vinay-vivobook plasmashell[13601]: file:///usr/share/plasma/wallpapers/a2n.blur/contents/ui/main.qml:84:21: QML QQuickImage: Cannot open: file:///usr/share/wallpapers/Malefo>
Jul 10 10:03:54 vinay-vivobook plasmashell[13601]: kf.svg: findInCache with a lastModified timestamp of 0 is deprecated
Jul 10 10:03:54 vinay-vivobook plasmashell[13601]: kf.svg: findInCache with a lastModified timestamp of 0 is deprecated
Jul 10 10:03:54 vinay-vivobook plasmashell[13601]: kf.svg: findInCache with a lastModified timestamp of 0 is deprecated
Jul 10 10:03:56 vinay-vivobook org_kde_powerdevil[13663]: Emitting DDCA_Display_Status_Event( 397682.418:  DDCA_EVENT_DPMS_AWAKE, card1-eDP-1, dref: Display_Ref[NULL], io_path:/dev/i2c-6]
Jul 10 10:03:56 vinay-vivobook org_kde_powerdevil[13663]: Executed 1 registered callbacks.
Jul 10 10:03:56 vinay-vivobook org_kde_powerdevil[13663]: Emitting DDCA_Display_Status_Event( 397682.419:  DDCA_EVENT_DPMS_AWAKE, card1-HDMI-A-1, dref: Display_Ref[bus /dev/i2c-5], io_path:>
Jul 10 10:03:56 vinay-vivobook org_kde_powerdevil[13663]: Executed 1 registered callbacks.
Jul 10 10:03:57 vinay-vivobook org_kde_powerdevil[13663]: dh=Display_Handle[i2c-5: fd=38], Replacing adjusted sleep multiplier 0.00 with 1.00 for SE_POST_WRITE or SE_POST_SAVE_SETTINGS
Jul 10 10:04:00 vinay-vivobook kernel: [UFW BLOCK] IN=wlp1s0 OUT= MAC=44:af:28:58:4b:34:0c:47:c9:cf:13:49:08:00 SRC=192.168.49.1 DST=192.168.68.111 LEN=389 TOS=0x00 PREC=0x00 TTL=64 ID=6097>
Jul 10 10:04:04 vinay-vivobook systemd[1]: dbus-:1.3-org.kde.powerdevil.backlighthelper@64.service: Deactivated successfully.