Automatically disable laptop screen when it is closed

I am using the latest version of KDE plasma on arch Linux.

I have noticed that when I have an external monitor connected to my laptop and use both the laptop and external screens at the same time, when I close the laptop screen it stays active as in I can still move windows to it, which then effectively become invisible because the laptop screen is closed.

I would like kde to automatically disable the laptop screen when closed. How can I do this? Currently I have to go to the settings and disable it manually.

Also once I disable it, the windows that were on it, do not reposition to the external monitor automatically. I have to press meta(windows key)+right arrow key to position them individually on the external screen. Is there a way for KDE to reposition them automatically making them fit on the screen if they are too big for the external monitor?

I’m using Debian 14 KDE Plasma 6.5.4, and have it exactly as expected with my laptop in a “desktop mode” (external monitor+keyboard+mouse). When I close the lid, it’s turned off (although seen still present in System Settings > Display Configuration), all open windows opened/positioned there are transferred to the external monitor.
Did you try ticking your external monitor as “Primary”? Maybe it will do the trick.