How do I align the bottom edges of two monitors with xrandr?

 xrandr --output LVDS1 --auto --pos 0x312 --output HDMI1 --auto --pos 1366x0

Basically, --pos specifies the position of the upper left corner of the screen in the virtual screen space. The virtual screen is a screen that spans your entire physical screens. This is a very generic way of specifying screen positions.

You want this configuration:

(virtual screen coordinates)
     0       1366                 1366+1920

   0           A-----------------------
               |                      |
               |                      |
               |                      |
  x? B---------|         HDMI         |
     |         |                      |
     |  LVDS   |       1920x1080      |
     |1366x768 |                      |
1080 ----------------------------------

And you need the coordinates of A and B to use in the --pos option. x is easily solved as 1080 - 768 = 312, so A is at (1366,0) and B is at (0,312).

Therefore, the appropriate --pos options are --pos 1366x0 for HDMI and --pos 0,312 for LVDS. You don't have to specify the virtual screen size (anymore), it is resized automatically.

Note that --pos can be abused, for exemple to create a hole between your two screens, or create overlapping. Most (all?) WM will not be able to handle that through.

EDIT: oh, you want the other way around, fixed that.


In addition to @BatchyX's excellent answer, an alternative —and IMO more convenient— option could be using ARandR (which stands for "Another XRandR GUI"):

ARandR is designed to provide a simple visual front end for XRandR. Relative monitor positions are shown graphically and can be changed in a drag-and-drop way.

You might need to install it first, but it's available in most distros' repositories. Here's how it looks for me on LXDE, for a setup with one external monitor connected via VGA, above, and the native (netbook-size) monitor underneath it:

ARandR screenshot


If you looking for a drag-and-drop GUI-based solution, I can recommend ARandR.

It allows you to set the most important XRandR settings, e.g. screen position and resolution, which then can be saved in form of a shell script that calls xrandr with the corresponding parameters.

Tags:

Linux

Xrandr