There is a Flatron E2042 in the office I work in and it's having the worst [firmware] problem I've ever seen in a display: it can't always work in full resolution.

Today is the day when it worked and I'd like to get the modeline for the correct resolution. It's not in Xorg.0.log and gtf/cvt are for calculating a modeline. AFAIU xrandr --verbose is showing all the needed numbers but rearranged and not readily available for later use in --newmode. And xvidtune -show lists only the internal display with nothing in the manual about selecting another one.

So, any other way to get the current modeline?


Script that I now use to make it work:

modeline="flatron_e2042 108.00 1600 1624 1704 1800 900 901 904 1000 +hsync +vsync"
xrandr --newmode $modeline
modename="$(echo ${modeline%% *})"
xrandr --addmode VGA1 $modename
xrandr --output VGA1 --mode $modename
  • How did you find the modeline?
    – Thomas
    Feb 14 '21 at 14:11

Try with xvidtune:

xvidtune -show
  • Why did this answer get accepted? It only shows the internal display (as mentioned in the question), and it's also what I'm looking for.
    – Thomas
    Feb 14 '21 at 14:10
  • What happens when you switch off the internal display and have only external one switched on?
    – int_ua
    Feb 15 '21 at 0:11

Not exactly the modeline, but you can download the monitor's EDID information where all supported resolutions are listed. I would use get-edid and parse-edid tools from read-edid package (http://manpages.ubuntu.com/manpages/oneiric/man1/get-edid.1.html). Then try to use the EDID information when starting X instead of asking the monitor for that information every time.

I know that nvidia driver has very good support for custom EDID file. I am not sure how it is supported in other drivers. I am sure you will figure it out.


sudo get-edid > ~/lg_edid
parse-edid < ~/lg_edid
  • 1
    Thanks, that worked :) parse-edid shows the modeline.
    – int_ua
    Mar 23 '16 at 20:00

The accepted answer claims that to get the current ModeLine one should use 'xvidtune' tool. Unfortunately, this program is showing the ModeLine that X server was started with but not the current one. Just try to change resolution (either using 'xrandr' or your window manager monitor controlling tool) and then run 'xvidtune -show' again and you'll see what I'm talking about. Probably, a better way to get current ModeLine is using 'xrandr' tool itself like this:

$ xrandr --verbose

For example, in my case the result is something like this (the only lines with the current ModeLine):

1920x1080 (0x251) 148.500MHz +HSync +VSync *current h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 67.50KHz v: height 1080 start 1084 end 1089 total 1125 clock 60.00Hz

As you can see, the current ModeLine is designated by the '*current' mark. In case of using more than one monitor, one would probably need to look for the apropriate section in xrandr's output marked with the output's name to which the monitor in question is connected (something like HDMI-0, DVI-D-0, VGA-0, etc).

  • Thank you, I've reverted the change of the accepted answer
    – int_ua
    Mar 3 '21 at 10:47
  • Actually, I don't see how the accepted answer fits your original question. You asked how to get current ModeLine for an external display. Looking at the EDID of the monitor does not answer what the effective current display mode is. Although a correct EDID does clearly answer what the desired resolution of the monitor is, the correct way to get the effective ModeLine is by directly querying the X's extension that's responsible for controlling display resolution and frequency. And this extension is called RANDR, hence 'xrandr' is a way to go about it. IMHO.
    – folivore
    Mar 8 '21 at 17:08
  • As mentioned in the question, xrandr --verbose didn't work for me at the time, was it changed? parse-edid was the only thing that worked in that particular case.
    – int_ua
    Mar 8 '21 at 21:10
  • Looking at the EDID info doesn't show the current display mode, it shows the table of approved monitor modes by the monitor's manufacturer, stored inside the monitor's EEPROM (internal memory, accessible using I2C bus). EDID is a static block of data, it is not changed no matter what the current display mode is. xvidtune uses XFree86-VidModeExtension, but it reports erroneous result as I've already mentioned before.
    – folivore
    Mar 12 '21 at 15:06
  • Let me stress it once again: your question is "How to get current Modeline for an external display?". But EDID answers another question "How to get all the display modes that my monitor's manufacturer deems as safely operable for this monitor". In no way looking at the EDID answers what the current monitor's modeline is.
    – folivore
    Mar 12 '21 at 15:22

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.