External connected screen stops responding after some time

Hi, I have Manjaro + Gnome installed on my laptop. (Asus Zenbook Pro 14 UX6404VV-P4046W)
When using a dock at home with displaylink i am able to attach 2 external screens without issue.
But at the office i just have 1 screen that i connect with the attached HDMI port. At first it seems to work fine but after a random amount of time the external screen just freezes. The laptop works fine but the screen does not update anymore.
I then use xrandr or the gnome display ui to change the settings and then it works for a short while.
I don’t seem to find anything in journalctl. And have no idea on how to debug this further to find a potential reason this is happening.

Sometimes it works for 30 minutes. but most of the time it locks up right away after some seconds. really annoying.

Below are some logs of commands i found in another post that could be useful. The screen thats not responding is the HDMI-1-0

Best regards,
Bastiaan

$ mhwd -li                                                                                                                   
> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
     video-modesetting            2020.01.13                true            PCI
video-hybrid-intel-nvidia-prime            2023.03.23               false            PCI
           video-linux            2018.05.04                true            PCI


Warning: No installed USB configs!
 
$ inxi -Gaz                                                                                                                          
Graphics:
  Device-1: Intel Raptor Lake-P [Iris Xe Graphics] vendor: ASUSTeK
    driver: i915 v: kernel arch: Gen-13 process: Intel 7 (10nm) built: 2022+
    ports: active: eDP-1 empty: DP-1,DP-2 bus-ID: 0000:00:02.0
    chip-ID: 8086:a7a0 class-ID: 0300
  Device-2: NVIDIA AD107M [GeForce RTX 4060 Max-Q / Mobile] vendor: ASUSTeK
    driver: nvidia v: 535.104.05 alternate: nouveau,nvidia_drm non-free: 535.xx+
    status: current (as of 2023-09) arch: Lovelace code: AD1xx
    process: TSMC n4 (5nm) built: 2022-23+ bus-ID: 0000:01:00.0
    chip-ID: 10de:28a0 class-ID: 0300
  Device-3: Shinetech USB2.0 FHD UVC WebCam driver: uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-9:2 chip-ID: 3277:0033
    class-ID: fe01 serial: <filter>
  Display: x11 server: X.org v: 1.21.1.8 with: Xwayland v: 23.2.0
    compositor: gnome-shell v: 44.5 driver: X: loaded: modesetting,nvidia
    unloaded: nouveau alternate: fbdev,nv,vesa dri: iris gpu: i915
    display-ID: :1 screens: 1
  Screen-1: 0 s-res: 3840x3960 s-size: <missing: xdpyinfo>
  Monitor-1: HDMI-1-0 pos: top res: 3840x2160 hz: 60 dpi: 163
    size: 597x336mm (23.5x13.23") diag: 685mm (26.97") modes: N/A
  Monitor-2: eDP-1 pos: primary,bottom res: 2880x1800 hz: 120 dpi: 234
    size: 312x195mm (12.28x7.68") diag: 368mm (14.49") modes: N/A
  API: EGL v: 1.5 hw: drv: intel iris drv: nvidia platforms: device: 0
    drv: nvidia device: 1 drv: iris device: 3 drv: swrast gbm: drv: iris
    surfaceless: drv: nvidia x11: drv: iris inactive: wayland,device-2
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: intel mesa v: 23.1.7-1
    glx-v: 1.4 direct-render: yes renderer: Mesa Intel Graphics (RPL-P)
    device-ID: 8086:a7a0 memory: 30.25 GiB unified: yes
$ pacman -Q|grep nvidia                                                                                                              
lib32-nvidia-utils 535.104.05-1
linux61-nvidia 535.104.05-8
mhwd-nvidia 535.104.05-1
mhwd-nvidia-390xx 390.157-8
mhwd-nvidia-470xx 470.199.02-3
nvidia-prime 1.0-4
nvidia-settings 535.104.05-1
nvidia-utils 535.104.05-1
$ sudo mhwd -a pci nonfree 0300                                                                                                      
> Skipping already installed config 'video-hybrid-intel-nvidia-prime' for device: 0000:01:00.0 (0300:10de:28a0) Display controller nVidia Corporation
> Skipping already installed config 'video-hybrid-intel-nvidia-prime' for device: 0000:00:02.0 (0300:8086:a7a0) Display controller Intel Corporation
 $ uname -r                                                                                                                           
6.1.53-1-MANJARO

This hybrid setup with PRIME should be using the iGPU (intel) by default, with the dGPU (nvidia) being called when you use prime-run.
It is likely the HDMI port plugs directly into the dGPU.

I dont have an assortment of ‘good ideas’ but I do have one … idea.

Use envycontrol (and gnome-shell-extension-gpu-profile-selector if you want the extension easy toggles) and set things to dGPU only (nvidia). This will probably kill battery life, but should let your HDMI port work reliably.

More elegant solutions might look something like this:
https://wiki.archlinux.org/title/PRIME#XRandR_specifies_only_1_output_provider