Skip to content
MoreDisplays

Type to search.

Manual contents

mdctl protect

Defend one display's resolution in the active group, or stop.

mdctl protect <reference> <state>

Arguments

Argument Type Required Meaning
reference string Yes The display, spelled the way `displays` prints it.
state on | off Yes Whether to put the resolution back when something changes it.

What it prints

One line saying which display is defended, and in which group.

Remote desktop software renegotiates resolution on connect, a monitor waking from sleep drops to its default, and a stray click in System Settings does the same. On a machine you reach only over the network, a resolution that changes by itself is a machine you cannot use.

Marking a display protected in the active group means the app puts it back.

mdctl protect physical:A1B2C3D4-5E6F-4071-8293-A4B5C6D7E8F9 on
Protecting "Studio Display" in "Home".

It restores the arrangement, not the one mode

A resolution change moves everything to the right of it. Restoring the size without the origins leaves a desk that is half correct and blames the app for it, so the whole arrangement is re-applied.

It concedes rather than fights

Five restores in twenty seconds is not a correction, it is two programs taking turns rewriting the framebuffer, which is worse for you than either outcome. The engine stops, says so once in the log, and waits until the group is activated again to be told what is wanted.

mdctl protect physical:A1B2C3D4-5E6F-4071-8293-A4B5C6D7E8F9 off
No longer protecting "Studio Display" in "Home".

Exit codes

The same four across every command, so a script can branch on the number without knowing which command produced it.

Code Name When
0 ok The command succeeded.
1 commandFailed The app understood the command and refused or failed it. The reason is on stderr.
2 usage The arguments were wrong. Nothing was sent.
3 appNotRunning No app is listening on the socket.