2

Question: How can I temporarily prevent Ubuntu from recognizing a second monitor that is plugged in? I'm looking for a solution that can be implemented remotely, without physical access to the machine at a given moment.

Background: The monitors are plugged into an NVIDIA 3080 RTX Ti GPU via Displayport. The machine runs Ubuntu 22.04 LTS.

Some possible approaches that don't work (well) : I do not see any option in Settings > Displays to disable a monitor. Mirroring the monitors would effectively accomplish my goal if not for the fact these two monitors are different resolutions, so the resolution is limited to that of the lesser monitor. We could simply unplug the second monitor whenever we're done working on the machine in person, but this is not convenient for everyone.

Rationale: I use VNC viewer to connect to an Ubuntu machine with two monitors. When connecting remotely, I have a smoother and more practical experience if I only work with the first monitor. The second only gets in the way unless I'm working on the machine in person.

1 Answer 1

1

First, make sure the right DISPLAY is used when typing the commands.

You can export DISPLAY

export DISPLAY=:0
xrandr

or put it in front of every command

DISPLAY=:0 xrandr

or use display as a parameter

xrandr -display :0

That command will list your outputs. You will be able to see which are active and what are their resolutions.

I would suggest you start xrandr to see which outputs are active. Then disable the output you do not want to be active. I cannot try it out, but I believe something like this would work.

# if you exported $DISPLAY
xrandr --output DP1 --off
# or set the variable only for this line
DISPLAY=:0 xrandr --output DP1 --off
# or use display in a parameter
xrandr -display :0 --output DP1 --off

You have to use your values for output (DP1 in the example) and for the DISPLAY (:0 in the example).

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .