have you looked at xrandr? you may be able to just run xrandr --auto after connecting the display, or you can explicitly ask for a mode with it with --output <foo> --mode <bar>. .mrg.