I'm using Debian 9. I have a laptop and a second monitor using an HDMI input. Whenever I start an application in a X11 session my screen display extends and I want my screen to mirror. Is there any way to do this?
1 Answer
Before you do anything, you’re going to need to find out a bit about your monitors, like how your system is referencing them, their available resolutions, and their refresh rates etc. You can accomplish all of this with a simple command to query your monitors called RandR.
$xrandr -q
Each heading is a listing for one of the ports on your graphics card. They’ll be something like DisplayPort-0
or HDMI-A-0
Next to each one of those, you’ll see if it’s connected or disconnected and which one is listed as the primary connection.
The --output
flag is necessary to specify which monitor you’re targeting.
The --mode
flag tells it which resolution to use.
The --rate
flag allows you to set your monitors refresh rate.
Dual monitor set-ups have some added flags that can be useful for positioning and priority.
The --primary
flag specifies the primary monitor.
You can use the --left-of
, --right-of
, --above
, --below
and --same-as another-output
flags to set the position of your other monitors.
So in order to mirror your secondary monitor to your laptop you could execute this command.
xrandr --output DisplayPort-0 --primary --mode 1920x1080 --rate 144.00 --output HDMI-A-0 --mode 1920x1080 --rate 60.00 --same-as DisplayPort-0