I’m trying to use a Linux laptop and a Linux desktop with one monitor. The monitor has two display port inputs. The desktop runs fine out of the box(however not using GNOME). The laptop uses AlmaLinux 9 with GNOME 40. The problem is every time the input on the monitor is switched to the other one the laptop detects that, the builtin screen goes off for few seconds and all the windows that were on the external monitor are moved to the builtin monitor.
I’ve tried disabling DPMS hoping that would do it, but it made no difference.
So my question is. How do I disable monitor detection in GNOME 40 temporarily? Why temporarily? Because I sometimes I need the ability for the laptop to detect monitor disconnect (I can run xrandr --auto in the terminal if required). I found lots of similar questions going as far back as GNOME 3 - back then there was a way to do it, but it was deprecated with no replacement.
Anyone has any idea?