How To Setup Dual Monitors With XRandR: Step By Step
Setting up dual monitors with XRandR can be a straightforward process once you understand the basics. Here’s a step-by-step guide to help you configure your dual-monitor setup using XRandR.
Finding Your Monitors
The first step is to identify the names and capabilities of your monitors. You can do this by running the xrandr command in your terminal. This command will display a list of all available outputs, along with their supported resolutions and refresh rates.
xrandr
This output will show you the names of your monitors (e.g., HDMI-1, DP-1) and their current status. For example:
Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 32767 x 32767
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
...
Setting Up Your Monitors
Once you know the names of your monitors, you can start configuring them. Here’s an example of how to set up two monitors with different resolutions:
xrandr --output DP-1 --primary --mode 1920x1080 --output HDMI-1 --mode 1360x768 --left-of DP-1
In this example:
DP-1is set as the primary monitor with a resolution of1920x1080.HDMI-1is set to the left ofDP-1with a resolution of1360x768.
If you have another monitor that you want to display to the right, you can add it to the command like this:
xrandr --output DP-1 --primary --mode 1920x1080 --output HDMI-1 --mode 1360x768 --left-of DP-1 --output HDMI-2 --mode 1360x768 --right-of DP-1
Positioning and Scaling Monitors
If you need to position or scale your monitors, you can use additional options with xrandr. For example, to position a monitor at a specific location, you can use the --pos option:
xrandr --output HDMI-1 --mode 1920x1080 --pos 1920x0
This command sets the HDMI-1 monitor to a resolution of 1920x1080 and positions it at coordinates (1920, 0).
To scale monitors, especially useful when combining monitors of different resolutions, you can calculate the positions and sizes based on the resolutions and desired layout. For instance, if you want to scale a 1080p monitor to match a 4K monitor, you would need to calculate the positions and scaling factors accordingly.
Making Changes Persistent
To ensure that your monitor settings are applied every time you boot your system, you need to add the xrandr command to a startup script. One common method is to add it to your .xinitrc or .xsession file:
xrandr --output DP-1 --primary --mode 1920x1080 --output HDMI-1 --mode 1360x768 --left-of DP-1
Make sure there is no & at the end of the xrandr command, as it is not needed and could cause issues.
Troubleshooting Common Issues
Identifying Monitors
If you have multiple monitors connected via the same type of cable (e.g., two HDMI monitors), it can be tricky to identify which is which. A simple method is to turn off all but one monitor and then activate each one individually to determine their names.
Display Not Detected
If a monitor is not detected by xrandr, ensure that it is properly connected and recognized by your system. You can check the output of xrandr -q to see if the monitor is listed. If it is not, you may need to adjust your graphics settings or check for any hardware issues.
Persistent Settings Not Working
If your settings are not persisting across reboots, ensure that the xrandr command is correctly placed in your startup script and that there are no syntax errors. Also, verify that the script is being executed during startup.
By following these steps, you can effectively set up and manage your dual-monitor configuration using XRandR.
Output from xrandr:
Screen 0: minimum 320 x 200, current 3360 x 1050, maximum 4096 x 4096
DVI-0 connected primary 1680×1050+0+0 (normal left inverted right x axis y axis) 598mm x 337mm
VGA-0 connected 1680×1050+1680+0 (normal left inverted right x axis y axis) 433mm x 270mm
1680×1050 59.94*+
DVI-0 is an HDMI Samsung with a DVI-HDMI adapter
VGA-0 is an Apple Cinema Display
GPU is a Radeon 9600XT
xrandr –output VGA-0 –right-of DVI-0 only results in a “mirrored desktop” as if the command “same as” is being used.
There is no command to “extend” desktop. Attempts to use xrandr to extend desktop have failed. What am I missing?
Operating system is Mint PPC64, Mac G5