Primary monitor detection fails when setting the secondary monitor position when the secondary monitor is to the left of the primary monitor or when the secondary monitor is on top. In these cases, the secondary monitor becomes the PRIMARY monitor.
I'm facing the same problem with the same setup (external monitor is left of laptop) with Xfce 4.16. The laptop display does not get the primary one :(
I am still having this issue in xfce 4.18 (installed with Debian 12). The Dell monitor attached via HDMI is being treated as the primary display even when the Laptop screen is set as primary.
xfce4-display-settings 4.18.2 (Xfce 4.18)Copyright (c) 2004-2023 The Xfce development team. All rights reserved.Please report bugs to <https://bugzilla.xfce.org/>.
in xrandr, the LVDS (Laptop) display is listed as primary, xfce4-display-settings shows it as primary, however the panel, icons and all new windows are on the Dell monitor.
Actually just checked the xfce-panel settings, and apparently specifying "primary" rather than "automatic" (what does automatic mean, then?) causes it to go to the correct display, so xfce itself /does/ know which is primary.
This seems to be a case of default settings not respecting which display is primary, resulting in no change whenever the primary monitor is changed. Basically the primary monitor /does/ get set, but all the other widgets don't care which monitor is primary by default and just go to the top-left. I'm not sure why this would be the case.
Okay, so there's no problem with xfce4-display-settings. No problem with xfce4-panel either (automatic mode tries to find the panel's previous position in global coordinates, i.e. without taking into account monitor names or which one is primary).
For xfdesktop I can't reproduce the problem with 4.18.1. I had reported a similar problem but it was a regression in 4.19.2 now fixed. I invite you to open a new issue there if necessary.
For xfwm4 I'm not sure if there is a setting to choose to position new windows on the primary monitor. But there are a few issues already open on this subject :