Keeping display configuration (with panning) after disconnecting external monitor from laptop

Hi all!
Setup

  • Laptop: Lenovo Legion 5 15ACH6 (with Nvidia GeForce RTX 3050) eDP-2
  • External monitor: Asus ZenScreen MB16AH Monitor 15.6" FHD (connected via USB C) DP-1-2

Other Info

  • The external monitor only works when the GeForce is active as the USB C display mode is hardwired to the external GPU
  • Nvidia driver version: 550.54.14
  • KDE Frameworks: Version 5.103.0

xrandr -q

output

Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 16384 x 16384
eDP-2 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
DP-1-2 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 344mm x 194mm

As I often need to be on the road, when I disconnect the external monitor KDE (gracefully) places all windows on the laptop’s monitor .
What I want is when Ι disconnect the external monitor to keep the same display configuration panning for the external monitor.

I haven’t tried anything so far as I don’t know where to begin.
I’m guessing a virtual output would be used?

Do I understand your post correctly in that you would like to not view the windows from the second display on your primary display even when the second display is disconnected?

If so, you could split the windows into two workspaces 1 and 2. Configure KDE to show workspace 1 on primary display and workspace 2 on secondary. When you disconnect secondary, KDE would move those to workspace 2 on your primary display but at least you won’t have to see it unless you switch worksapces.

Almost.
When I disconnect the second display I want that space to be panning horizontally and windows that were on that display to remain as they were so I can get to them by moving the mouse to the far right of the primary display.

Ah okay, workspaces are your tool of choice for this :slightly_smiling_face:

You might need an addon to move over to the workspace on the right when moving mouse there, normally it’s done using a keyboard shortcut (Super + PgUp/Dn) or weird mouse actions in Gnome (scrolling from the top left workspace indicator)

Could you please elaborate a bit more on workspaces?
Is it a freedesktop feature? I use only KDE (as mentioned on the first post) and heavily utilizing activities so it has to be either DE agnostic or KDE.

I think KDE calls it virtual desktops:

I am a heavy user of Virtual desktops and Activities in KDE and unfortunately what I want can’t be achieved using these features.

I am pretty sure this should require some scripting to create a mode with xrandr to have a viewport that could either be the external monitor (when connected) or switch to virtual screen (when disconnecting) the external screen, probably reading the disconnect event from udev?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.