Geometry (position of screen) lost after disabling and enabling screen from command line using kscreen-doctor

I want to be able to disable and enable specific screen from command line so that the layout of all screens (their relative positions to each other) would be the same after re-enabling screen like it was before first disabling screen.

I have two identical screens side by side, HDMI-A-1 on the left and DP-1 on the right (it’s set as the primary one):

$ kscreen-doctor -o | grep -e Output -e Geometry
Output: 1 HDMI-A-1
        Geometry: 0,0 1920x1200
Output: 2 DP-1
        Geometry: 1920,0 1920x1200

When I run kscreen-doctor output.HDMI-A-1.disable to disable the left one and then kscreen-doctor output.HDMI-A-1.enable to enable it back both show the same content instead of extended desktop like it was before disabling and enabling the left screen.
I guess it’s due to changed geometry of the right screen after disabling/enabling the left screen (the new value of 0,0 instead of the previous value of 1920,0):

$ kscreen-doctor -o | grep -e Output -e Geometry
Output: 1 HDMI-A-1
        Geometry: 0,0 1920x1200
Output: 2 DP-1
        Geometry: 0,0 1920x1200

The fact that disabling and enabling one screen (HDMI-A-1) changes geometry of another screen (DP-1) is a little surprising but on the other hand, after disabling the left screen, the right one still having geometry of 1920,0 i.e. being positioned to the right of no longer existing left screen does not indeed make sense.

The question is why does it work this way using kscreen-doctor when doing the same from Display Settings works as expected i.e. the relative position of screens is not lost and after re-enabling the left screen it’s still on the left of the other one like before disabling?
Where does Display Settings store information on geometry so that it could be restored after re-enabling a screen?

I’m aware that the solution in this case is to use kscreen-doctor output.HDMI-A-1.enable output.DP-1.position.1920,0 when re-enabling the left screen to also set position of the right screen back to where it was before disabling the left screen.

(Btw, could someone add screen(s) tag)

being positioned to the right of no longer existing left screen does not indeed make sense.

..and essentially you seem to be asking “Why”?

Well, it seems like a reasonable response to the instruction to remove the first screen. The software has carried out the explicit requirement of the instruction. There’s no explicit information or requirement about what to do next (i.e. change or normalize the coordinates of the remaining display(s)). This isn’t unreasonable behavior and there are use cases for it.

e.g. What if one has 3 screens with one large screen below and two above. What is reasonable behavior if the screen at the bottom is disabled? Extend, subtract or leave the vertical coordinates as is (and there are other possibilities)?

Perhaps additional options could be developed to allow specification of such follow-on behavior?

I agree but you are describing the behavior when disabling a screen whereas I’m more interested with the behavior when re-enabling the same screen. I compared this to the behavior seen when doing the same (re-enabling previously disabled screen) in Display Settings where position of the right screen is automatically restored. The question is why doesn’t kscreen-doctor do the same i.e. restoring positions of other screens which had been reset due to disabling some screen?