LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 08-13-2018, 05:59 AM   #1
DAFlippers
LQ Newbie
 
Registered: Aug 2018
Posts: 5

Rep: Reputation: Disabled
How to get monitor number in multi display configuration


When you configure a multi display setup in Linux you can place the monitors as you wish and a single desktop canvas is created. In a very simple example I could place two monitors, each 1920x1200, side by side to create a 3840x1200 desktop.

The problem I have is that I could have placed:

Monitor 1 Monitor 2

or

Monitor 2 Monitor 1

I know the desktop size and I can use XRRGetMonitors() to get the position of each monitor but not the number that is used in the configuration tool and I need the id number for my application. I am sure it is simple but I haven't found a way thus far.

It appears the monitor data is stored from top left to bottom right in files like monitors.xml however the display id number is not held in any file I have found so far. Xrandr also outputs screens top left to bottom right but does not give display id number. I need the id number of the display shown in the Display arrangement in the Screen Display GUI as I need to sync this with external applications.

Can someone enlighten me please?
 
Old 08-25-2018, 09:22 PM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,819

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
I don't have a definitive answer here, but from an xrandr perspective it's the display interface that's relevant (rather than some arbitrary number). For example...

Code:
xrandr --auto --output HDMI1 --primary --left-of VGA1
 
Old 08-26-2018, 02:36 AM   #3
DAFlippers
LQ Newbie
 
Registered: Aug 2018
Posts: 5

Original Poster
Rep: Reputation: Disabled
Unfortunately the screen layouts are set up by users using the system GUI and that is why I need the internal numeric IDs for the screens. I am amazed that no-one knows how to obtain these IDs.

David
 
Old 08-26-2018, 03:48 AM   #4
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,819

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
Quote:
Unfortunately the screen layouts are set up by users using the system GUI and that is why I need the internal numeric IDs for the screens. I am amazed that no-one knows how to obtain these IDs.
You haven't mentioned the GUI in question. KDE's "Display and Monitor" utility shows the layout with interface labels. These are consistent with those reported by xrandr. I can't see the need for any other arbitrarily-assigned ID.
 
Old 08-26-2018, 04:47 AM   #5
DAFlippers
LQ Newbie
 
Registered: Aug 2018
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
KDE's "Display and Monitor" utility shows the layout with interface labels. These are consistent with those reported by xrandr.
In Ubuntu Settings:evices::Screen Display I can arrange the Screens and they are shown with numeric IDs in the GUI and on each screen when GUI has focus. The GUI shows monitor name however all monitors are the same type so I can't use name to determine screen. xrandr output below. I can see port but not the ID. In the below Screen ID 1 is above (with slight offset to right) of screen ID 2.

david@david-desktop:~$ xrandr
Screen 0: minimum 320 x 200, current 2772 x 2160, maximum 8192 x 8192
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 connected primary 1920x1080+0+1080 (normal left inverted right x axis y axis) 531mm x 299mm
1920x1080 60.00*+
1600x1200 60.00
1680x1050 59.88
1280x1024 75.02 60.02
1440x900 59.90
1280x960 60.00
1152x864 75.00
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
640x480 75.00 72.81 66.67 59.94
720x400 70.08
HDMI-3 connected 1920x1080+852+0 (normal left inverted right x axis y axis) 531mm x 299mm
1920x1080 60.00*+ 50.00 59.94 59.99
1920x1080i 60.00 50.00 59.94
1600x1200 60.00
1680x1050 59.88
1280x1024 75.02 60.02
1440x900 59.90
1280x960 60.00
1366x768 59.79
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
720x576 50.00
720x480 60.00 59.94
640x480 75.00 72.81 66.67 60.00 59.94
720x400 70.08
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-1-4 disconnected (normal left inverted right x axis y axis)
DP-1-5 disconnected (normal left inverted right x axis y axis)
DP-1-6 disconnected (normal left inverted right x axis y axis)
DP-1-7 disconnected (normal left inverted right x axis y axis)
david@david-desktop:~$


Now I have changed ports and the GUI shows Screen 2 to the left of Screen 1. xrandr reports:


david@david-desktop:~$ xrandr
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 8192 x 8192
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 299mm
1920x1080 60.00*+
1600x1200 60.00
1680x1050 59.88
1280x1024 75.02 60.02
1440x900 59.90
1280x960 60.00
1152x864 75.00
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
640x480 75.00 72.81 66.67 59.94
720x400 70.08
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
HDMI-3 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 531mm x 299mm
1920x1080 60.00*+ 50.00 59.94 59.99
1920x1080i 60.00 50.00 59.94
1600x1200 60.00
1680x1050 59.88
1280x1024 75.02 60.02
1440x900 59.90
1280x960 60.00
1366x768 59.79
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
720x576 50.00
720x480 60.00 59.94
640x480 75.00 72.81 66.67 60.00 59.94
720x400 70.08
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-1-4 disconnected (normal left inverted right x axis y axis)
DP-1-5 disconnected (normal left inverted right x axis y axis)
DP-1-6 disconnected (normal left inverted right x axis y axis)
DP-1-7 disconnected (normal left inverted right x axis y axis)
david@david-desktop:~$



I now move Screen 2 to right of Screen 1 in the GUI and xrandr reports:


david@david-desktop:~$ xrandr
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 8192 x 8192
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 531mm x 299mm
1920x1080 60.00*+
1600x1200 60.00
1680x1050 59.88
1280x1024 75.02 60.02
1440x900 59.90
1280x960 60.00
1152x864 75.00
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
640x480 75.00 72.81 66.67 59.94
720x400 70.08
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
HDMI-3 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 299mm
1920x1080 60.00*+ 50.00 59.94 59.99
1920x1080i 60.00 50.00 59.94
1600x1200 60.00
1680x1050 59.88
1280x1024 75.02 60.02
1440x900 59.90
1280x960 60.00
1366x768 59.79
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
720x576 50.00
720x480 60.00 59.94
640x480 75.00 72.81 66.67 60.00 59.94
720x400 70.08
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-1-4 disconnected (normal left inverted right x axis y axis)
DP-1-5 disconnected (normal left inverted right x axis y axis)
DP-1-6 disconnected (normal left inverted right x axis y axis)
DP-1-7 disconnected (normal left inverted right x axis y axis)
david@david-desktop:~$


So xrandr reports in port order but does not provide the ID I need.


Or am I missing something obvious?
 
Old 08-26-2018, 05:16 AM   #6
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,819

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
I'm not 100% certain, but from what you've posted the xrandr interface order seems to be significant. In the examples you gave, the last connected interface seems to be mapped to screen ID 1, with screen ID 2 being the next prior connected display interface.

So 'HDMI-1 connected' and 'HDMI-3 connected' would appear to be associated with screen ID 2 and screen ID 1 respectively. Likewise, for the case with 'HDMI-2 connected' and 'HDMI-3 connected' would perhaps correspond with screen ID 2 and screen ID 1 respectively. Does that make sense?
 
Old 08-26-2018, 05:29 AM   #7
DAFlippers
LQ Newbie
 
Registered: Aug 2018
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
So 'HDMI-1 connected' and 'HDMI-3 connected' would appear to be associated with screen ID 2 and screen ID 1 respectively. Likewise, for the case with 'HDMI-2 connected' and 'HDMI-3 connected' would perhaps correspond with screen ID 2 and screen ID 1 respectively. Does that make sense?
In the above example yes however the ID in the GUI depends on the order that you plug in the screens - if I plug in HDMI 3 only then that will be ID 1 and then I plug in HDMI 1 that will become ID 2 but if I started with HDMI 1 then that would be ID 1 etc.. See the problem?
 
Old 08-26-2018, 05:37 AM   #8
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,819

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
I'm not sure. You might need to test that scenario perhaps. I'm not a Gnome user unfortunately.
 
Old 08-26-2018, 05:43 AM   #9
DAFlippers
LQ Newbie
 
Registered: Aug 2018
Posts: 5

Original Poster
Rep: Reputation: Disabled
That is the case which is why I want to get the ID used in the GUI....

Thanks for your suggestions, though.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Ubuntu's Mir Display Server Prepares for Vulkan, Adds Better Multi-Monitor Support LXer Syndicated Linux News 0 12-22-2015 08:08 PM
best practice Multihead, multi-screen, multi-display or multi-monitor-Debian 8 lgtrean Linux - Software 1 10-14-2015 09:53 AM
How to make Display Managers Recognize Multi-Monitor Settings cwwgateway Linux - Hardware 2 02-07-2013 06:36 PM
ATI multi card, multi display xinerama composite problem decibelcooper Linux - Hardware 2 06-24-2011 10:09 PM
Multi-display with Fluxbox - extended desktop/workspace configuration Rashkavar Linux - Desktop 1 01-27-2011 08:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 04:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration