main: add debug options
add a X event loop