Software & AppsOperating SystemLinux

How To Position Multiple Monitors with Command Line: Xrandr and Display Manager

Ubuntu 12

In the modern workspace, using multiple monitors is a common practice. It boosts productivity by providing more screen real estate and allows for multitasking. However, positioning these monitors can sometimes be a challenge. This article will guide you through the process of positioning multiple monitors using the command line, specifically focusing on Xrandr and Display Manager.

Quick Answer

To position multiple monitors using the command line, you can use Xrandr and Display Manager. Xrandr allows you to change the size, orientation, and position of the outputs of a screen. You can use the --pos option in the Xrandr command to specify the position of each monitor. If you want to automate the positioning of your monitors, you can add the Xrandr command to your Display Manager’s startup script.

Understanding Xrandr

Xrandr is a simple command-line utility designed to interact with the RandR extension of the X Window System. It allows users to change the size, orientation, and/or reflection of the outputs of a screen.

To get started with Xrandr, you can open a terminal and type xrandr. This will display the connected screens and their respective resolutions.

Display Manager

The Display Manager is the component of your operating system responsible for launching your X server and starting your desktop environment. It provides a graphical login capability and manages user sessions.

Positioning Monitors with Xrandr

To position monitors, we’ll use the --pos option in the Xrandr command. This option allows you to specify the position of the upper-left corner of an output in the framebuffer. The syntax is --pos xxy, where xx is the x coordinate and y is the y coordinate.

For instance, if you have two monitors, eDP1 and HDMI2, and you want to position HDMI2 to the left of eDP1, you can use the following command:

xrandr --output HDMI2 --pos 0x0 --output eDP1 --pos 1920x0

In this command, --output specifies the monitor, and --pos sets the position. The position 0x0 is the top left corner of the screen. The position 1920x0 places the second monitor to the right of the first, assuming a resolution of 1920 pixels wide for the first monitor.

Automating Monitor Positioning with Display Manager

If you want to automate the positioning of your monitors every time you log in, you can add the Xrandr command to your Display Manager’s startup script. The process for this varies depending on the Display Manager you’re using.

For instance, if you’re using LightDM, you can add the command to the /etc/lightdm/lightdm.conf file under the [Seat:*] section:

[Seat:*]
display-setup-script=/usr/bin/xrandr --output HDMI2 --pos 0x0 --output eDP1 --pos 1920x0

Remember to replace the command with the one that suits your monitor setup.

Conclusion

Positioning multiple monitors might seem like a daunting task, but with the help of Xrandr and Display Manager, you can easily customize your workspace to fit your needs. Remember to replace the monitor names and positions in the examples with the ones that match your setup. For more information about Xrandr and its options, you can refer to the man xrandr manual page or visit the Xrandr project page.

How do I check the connected screens and their resolutions using Xrandr?

To check the connected screens and their resolutions using Xrandr, open a terminal and type xrandr. This command will display the connected screens and their respective resolutions.

How can I position multiple monitors using Xrandr?

To position multiple monitors using Xrandr, you can use the --pos option followed by the desired coordinates. For example, xrandr --output HDMI2 --pos 0x0 --output eDP1 --pos 1920x0 will position HDMI2 to the left of eDP1.

Can I automate the positioning of my monitors with the Display Manager?

Yes, you can automate the positioning of your monitors with the Display Manager. You can add the Xrandr command to your Display Manager’s startup script. The process for this varies depending on the Display Manager you’re using. For example, with LightDM, you can add the command to the /etc/lightdm/lightdm.conf file under the [Seat:*] section.

Where can I find more information about Xrandr and its options?

For more information about Xrandr and its options, you can refer to the man xrandr manual page or visit the Xrandr project page.

Leave a Comment

Your email address will not be published. Required fields are marked *