2

I want to get information about the displays, something like xrandr, but with more info.

I want to know their position. So if I have two or more displays connected I want to know how they are related to each other. If we are using the displays as an extending and not as a duplicate. With a shell command I want to know If I have any display to the left, right, up or down.

Is there something similar? Or at least a command where I give the id of the display and it tells me if I have another display in any direction?

  • 1
    The output of xrandr has all the information, “all” you need is to parse it. – Gilles Jul 2 '14 at 23:13
  • Thanks for the tip, I have managed to understand the xrandr output, so I decided to answer my own question. – Fabio Antunes Jul 13 '14 at 2:43
2

Well I couldn't test all the options, but it seems that xrandr has a left to right and top to bottom orientation.

Here's a screenshot of my monitors to help understand better:

monitors layout

When I run xrandr on my Terminal, this is what I get:

Screen 0: minimum 320 x 200, current 3046 x 1050, maximum 32767 x 32767
LVDS1 connected 1366x768+0+282 (normal left inverted right x axis y axis) 344mm x 193mm
   1366x768       60.0*+
   1360x768       59.8     60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 connected 1680x1050+1366+0 (normal left inverted right x axis y axis) 473mm x 296mm
   1680x1050      60.0* 
   1024x768       60.0  
   800x600        60.3     56.2  
   848x480        60.0  
   640x480        59.9  

Now on this output for me at first, there wasn't anything that could make me figure how they are related, but messing around with the Monitors layouts and after reading I find out how xrandr represents the relationships between Monitors.

If you notice my Monitors have different resolution screens and xrandrcreates some sort of virtual resolution combining the biggest width with the biggest height.

That's why on the first line of my output I get that my current resolution is:

3046 x 1050 = (1366+1680) x 1050

We add both width resolutions and keep the biggest height.

This is because I have my Monitors layout side by side, if by any chance I change my Monitors layout to something like this:

monitors layout 2

The xrandr is this:

Screen 0: minimum 320 x 200, current 1680 x 1818, maximum 32767 x 32767
LVDS1 connected 1366x768+314+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1366x768       60.0*+
   1360x768       59.8     60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 connected 1680x1050+0+768 (normal left inverted right x axis y axis) 473mm x 296mm
   1680x1050      60.0* 
   1024x768       60.0  
   800x600        60.3     56.2  
   848x480        60.0  
   640x480        59.9 

So as you may have noticed, the virtual resolution now is:

1680 x 1818 = 1680 x (768+1050)

Now returning to the first layout and xrandr output, my laptop resolution was this:

LVDS1 connected 1366x768+0+282

So what this means is that my laptop is as left as possible to the origin (my X is zero) and also has a 282px distance to the origin from the top (my Y is 282px or -282px, but lets assume 282px for the sake of simplicity):

Monitors Layout

And if I check the xrandr output for my other Monitor I get:

VGA1 connected 1680x1050+1366+0

1366 is the width of my laptop Monitor, so I can assume that this display is on the right of my laptop Monitor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.