diff --git a/src/main.cpp b/src/main.cpp index 268c88d..fda32a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,8 @@ #include #include +#include + #include "config/config.h" #include "xdg.hpp" @@ -18,6 +20,16 @@ int main() { Config config(path); #endif + // Check if X is running + Display* disp = XOpenDisplay(NULL); + if (!disp) { + // Can't really start an X window manager without X. + std::cerr << "X is not running, please start X first!"; + return 1; + } + XCloseDisplay(disp); + free(disp); // Not sure if X frees this pointer, going to do it anyways until told otherwise. + // opens connection to display server (xorg) xcb_connection_t* connection = xcb_connect(NULL, NULL);