diff --git a/src/main.cpp b/src/main.cpp index 85c902f3..0152629a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,24 +41,6 @@ int main(int argc, char** argv) { logger& logger{const_cast(logger::make(loglevel::WARNING))}; try { - //================================================== - // Connect to X server - //================================================== - XInitThreads(); - - // Store the xcb connection pointer with a disconnect deleter - unique_ptr xcbconn{xutils::get_connection()}; - - if (!xcbconn) { - logger.err("A connection to X could not be established... "); - return EXIT_FAILURE; - } - - connection& conn{connection::make(&*xcbconn)}; - conn.preload_atoms(); - conn.query_extensions(); - conn.ensure_event_mask(conn.root(), XCB_EVENT_MASK_PROPERTY_CHANGE); - //================================================== // Parse command line arguments //================================================== @@ -85,6 +67,25 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } + //================================================== + // Connect to X server + //================================================== + XInitThreads(); + + // Store the xcb connection pointer with a disconnect deleter + unique_ptr xcbconn{xutils::get_connection()}; + + if (!xcbconn) { + logger.err("A connection to X could not be established... "); + return EXIT_FAILURE; + } + + connection& conn{connection::make(&*xcbconn)}; + conn.preload_atoms(); + conn.query_extensions(); + conn.ensure_event_mask(conn.root(), XCB_EVENT_MASK_PROPERTY_CHANGE); + + //================================================== // Load user configuration //==================================================