Bug 453273 - When laptop lid closes, windows on its screen jump to external display; when it is re-opened, windows don't jump back to it
Summary: When laptop lid closes, windows on its screen jump to external display; when ...
Status: RESOLVED INTENTIONAL
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.24.4
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2022-05-01 20:26 UTC by kittenwolf
Modified: 2022-05-09 17:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kittenwolf 2022-05-01 20:26:31 UTC
SUMMARY
***
When I add a second display and configure power settings to do nothing, KScreen2 moves all windows to the second monitor and crashes both desktops when I close my laptop lid.
***
After adding an external monitor as a second display in Display Manager, setting the laptop lid action under Power Management settings to "Do nothing" and checking "Even when external monitor is connected"

STEPS TO REPRODUCE
1. Install Kubuntu on a laptop
2. Acquire and connect an external monitor
3. Go to Control Center -> Power Management, ensure "Button  events handling" is checked, and select  "Do nothing" for "When laptop lid closed", and optionally click "Even when an external monitor is connected"
4. Edit /etc/systemd/logind.conf, and set HandleLidSwitch=ignore
5. Restart.
6. Login and open some windows.
7. Close your laptop lid.

OBSERVED RESULT
The external screen blacks out and restarts, and all windows jump over to the external screen. When I open my laptop, the windows don't jump back; I have to either kill them and restart them (conky) or drag them back. Additionally plasma desktop seems to crash and restart on both screens.

EXPECTED RESULT
Nothing at all should happen, since I never defined that I want windows to move to the external monitor.

I recognize the added value of having windows move to the external monitor - this would be useful if I was using the monitor instead of my laptop monitor. However, for my use case, this is not helpful.

This behavior would be explicitly configurable in KDE Control Center, so people who want windows to jump to the external monitor could do that, and people who don't could configure it differently. I should not need to disable KScreen2 and use arandr; that's not something a beginner user would even know how to do.

SOFTWARE/OS VERSIONS
OS: Linux
Linux Distro: Kubuntu 22.04
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

Additional Info:
I'm using Xorg
Comment 1 Nate Graham 2022-05-03 16:02:05 UTC
Can you paste the output of `grep IgnoreLid /etc/UPower/UPower.conf`? If it says "IgnoreLid=true", then it's an upstream bug in upower, and this may be a duplicate of Bug 448400.
Comment 2 kittenwolf 2022-05-03 21:35:10 UTC
(In reply to Nate Graham from comment #1)
> Can you paste the output of `grep IgnoreLid /etc/UPower/UPower.conf`? If it
> says "IgnoreLid=true", then it's an upstream bug in upower, and this may be
> a duplicate of Bug 448400.

That bug looks quite different from mine. I *want* closing the lid to do nothing. The poster in the bug you referenced wants closing the lid to suspend the laptop. I don't want that.

Disabling KScreen 2 and setting up arandr to manage my screens solved all of my issues related to this particular problem, so this seems to me to be solidly a KScreen 2 problem, not an upstream upower problem.
Comment 3 Nate Graham 2022-05-04 15:32:45 UTC
Thanks. It seems like the real problem here is the following:

>  When I open my laptop, the windows don't jump back

If that were fixed, you wouldn't be wanting a way to make the behavior configurable. So IMO let's fix that. :)
Comment 4 kittenwolf 2022-05-04 22:13:49 UTC
(In reply to Nate Graham from comment #3)
> Thanks. It seems like the real problem here is the following:
> 
> >  When I open my laptop, the windows don't jump back
> 
> If that were fixed, you wouldn't be wanting a way to make the behavior
> configurable. So IMO let's fix that. :)

I apologize; this is kind of a weird situation and I messed up in explaining this well.

Current workaround:

I disabled KScreen 2, following advice I found on reddit, following a google search. This caused the problem that screen positions weren't remembered, so I installed arandr, saved the config, and configured the script it generates to run on startup in KDE. Ever since I've done this, everything works the way I want: closing the laptop lid does nothing, and when I log in, the screen display ends up the way I would like it to be.

The Problem:

Before I arrived at my workaround, detailed above, I was frustrated by this problem: whenever I closed my laptop's lid, all the windows on my laptop's display jumped over to the external display. Also, plasma desktop would crash: the screen would go black, then the wallpaper would redraw, then eventually the task manager would return. Since the default install leaves KScreen 2 enabled, I figured I should file a bug report, since this must be effecting other people, especially given the fact that disabling KScreen 2 was recommended as a workaround.

Background:

I already modified power settings, because I didn't want my computer to suspend when I close the laptop lid, so that was the first thing I did after installing KDE. So, I'm not sure how upower fits in to the equation here.
Comment 5 Nate Graham 2022-05-05 21:32:38 UTC
>  I was frustrated by this problem: whenever I closed my laptop's lid, all the windows on my laptop's display
> jumped over to the external display.
Is that not what you would expect them to do? If they didn't do this, then the windows on the laptop screen would just be inaccessible. Is that what you want to happen?
Comment 6 kittenwolf 2022-05-06 02:18:44 UTC
Yeah, I didn't want that to happen. I know my case is pretty non-standard; my second display is a television screen. I use it for listening to music (mpd) or watching videos (which I put on the screen either with a script, or by dragging my browser window over). Mostly I just put a full-screen black image up and use my TV for music.
Comment 7 kittenwolf 2022-05-06 05:03:07 UTC
Just to clarify: yes, I want the windows on my laptop to remain on my laptop display, and not jump over to the TV when I close the lid.
Comment 8 Nate Graham 2022-05-09 15:32:20 UTC
Thanks for the clarification.

Unfortunately I don't think it's feasible for us to formally support that workflow. It would be very unexpected and destructive to allow windows to become inaccessible when the screens they're on are turned off. Most people would panic over such a thing.

Since you are highly technically adept and have a specialized use case that benefits from doing that anyway, and you've already found a workaround that works for you, I'd recommend simply continuing to use it. But do understand that it's an explicitly unsupported setup so we're not able to provide support for it in KDE. Sorry I couldn't give you better news!
Comment 9 kittenwolf 2022-05-09 16:57:13 UTC
(In reply to Nate Graham from comment #8)
> Thanks for the clarification.
> 
> Unfortunately I don't think it's feasible for us to formally support that
> workflow. It would be very unexpected and destructive to allow windows to
> become inaccessible when the screens they're on are turned off. Most people
> would panic over such a thing.
> 
> Since you are highly technically adept and have a specialized use case that
> benefits from doing that anyway, and you've already found a workaround that
> works for you, I'd recommend simply continuing to use it. But do understand
> that it's an explicitly unsupported setup so we're not able to provide
> support for it in KDE. Sorry I couldn't give you better news!

Understandable - this is a volunteer-based effort after all. Thanks for helping the project.
Comment 10 Nate Graham 2022-05-09 17:17:31 UTC
You're welcome! Thanks a lot for your understanding.