How can I disable the "replica of" setting for my external monitor via command line?

Hi!
I’m trying to create a script (and shortcuts) to switch between differents display setting for my laptop and external monitor. I used kscreen-doctor to set the “laptop only” mode, and also the “mirrored display” mode. But I cannot reliably get the external monitor to be above my laptop screen.

The position and resolution setting works fine when the “replica of” setting of the external monitor is set via the GUI to “none”. But that setting tends to be set back to replicate the laptop screen when restarting or disconnecting, and then kscreen-doctor can’t seem to bypass that setting , so the screens just stay mirrored.

So my question is : how can that settings be modified by a script or command line ?

Or is there a better way than using kscreen-doctor?

Thanks !

On Plasma 6.8, kscreenctl seems to do this nicely. (Caution, I haven’t tested, only read the command’s --help output.)

For example it looks like this would make DP-1 be a replica of HDMI-A-1:

kscreenctl DP-1 set-replica-of HDMI-A-1

and this would make DP-1 be an independent screen, not a replica:

kscreenctl DP-1 set-replica-of

Thanks for the information, I guess I just need to wait for plasma 6.8 to release and get to cachyOS :+1: (so maybe 3 months or so)

Meanwhile do you know whether it would be possible to somehow install it on plasma 6.7 or use some other tool ?

Thanks !

It should be possible for now using kscreen-doctor.

I think (but without high confidence) the equivalents would be something like:

kscreen-doctor output.DP-1.mirror.HDMI-A-1  # enable replication
kscreen-doctor output.DP-1.mirror.none # disable replication

Nope, doesn’t seem to work, and I can’t find any sign of a “mirror” property in the docs

It’s in the code, but I didn’t trace all the way through to see how it surfaces in the CLI syntax.

I tested a bit, and these commands actually do work for me!

Albeit that’s on Plasma 6.8 - I can’t see an obvious difference between 6.7 and 6.8 as far as this code goes, but it could be that something’s different.

Tried again and it works for me, thanks a lot!

Don’t know what didn’t work beforehand, maybe it’s unreliable… Or maybe I just did a typo :slight_smile: