void KwmExecuteConfig() { char *HomeP = std::getenv("HOME"); if(!HomeP) { DEBUG("Failed to get environment variable 'HOME'"); return; } KWMPath.EnvHome = HomeP; KwmParseConfig(KWMPath.ConfigFile); }
int main(int argc, char **argv) { if(ParseArguments(argc, argv)) return 0; NSApplicationLoad(); if(!AXLibDisplayHasSeparateSpaces()) Fatal("Error: 'Displays have separate spaces' must be enabled!"); AXLibInit(&AXState); AXLibStartEventLoop(); if(!KwmStartDaemon()) Fatal("Error: Could not start daemon!"); OverlayLibInitialize(); DEBUG("OverlayLib initialized!"); ax_display *MainDisplay = AXLibMainDisplay(); ax_display *Display = MainDisplay; do { ax_space *PrevSpace = Display->Space; Display->Space = AXLibGetActiveSpace(Display); Display->PrevSpace = PrevSpace; Display = AXLibNextDisplay(Display); } while(Display != MainDisplay); FocusedDisplay = MainDisplay; FocusedApplication = AXLibGetFocusedApplication(); KwmInit(); KwmParseConfig(KWMPath.Config); KwmExecuteInitScript(); CreateWindowNodeTree(MainDisplay); /* TODO(koekeishiya): Probably want to defer this to run at some point where we know that * the focused application is set. This is usually the case as 'Finder' is always reported * as the active application when nothing is running. The following behaviour requries * refinement, because we will (sometimes ?) get NULL when started by launchd at login */ if(FocusedApplication && FocusedApplication->Focus) UpdateBorder(&FocusedBorder, FocusedApplication->Focus); ConfigureRunLoop(); CFRunLoopRun(); return 0; }