void init_workspaces() { int n; WScreen *scr=SCREEN; CARD32 data[2]; if(scr->n_workspaces<=0){ scr->n_workspaces=CF_DEFAULT_N_WORKSPACES; scr->workspaces_horiz=CF_DEFAULT_N_WORKSPACES; scr->workspaces_vert=1; } n=0; get_integer_property(scr->root, wglobal.atom_workspace_num, &n); if(n>scr->n_workspaces){ warn("_PWM_WORKSPACE_NUM property out of range. Defaulting to 0."); n=0; set_integer_property(scr->root, wglobal.atom_workspace_num, 0); } scr->current_workspace=n; /* Store virtual desktop dimensions */ data[0]=SCREEN->workspaces_horiz; data[1]=SCREEN->workspaces_vert; XChangeProperty(wglobal.dpy, SCREEN->root, wglobal.atom_workspace_info, XA_INTEGER, 32, PropModeReplace, (uchar*)data, 2); }
int main() { auto pkgs = get_integer_property("hw.packages").get(); cc::println("Number of CPU packages: $.", pkgs); auto phys = get_integer_property("hw.physicalcpu").get(); auto phys_max = get_integer_property("hw.physicalcpu_max").get(); cc::println("Number of physical CPUs available: $/$.", phys, phys_max); auto log = get_integer_property("hw.logicalcpu").get(); auto log_max = get_integer_property("hw.logicalcpu_max").get(); cc::println("Number of logical CPUs available: $/$.", log, log_max); auto cache_config = get_array_property("hw.cacheconfig").move(); auto cache_sizes = get_array_property("hw.cachesize").move(); auto end = boost::find_if(cache_config, [](auto x) { return x == 0; }); assert(end != cache_config.begin()); assert(end != cache_config.end()); auto cache_levels = end - cache_config.begin() - 1; cc::println("Number of cache levels: $.", cache_levels); }