static void config_tag(void) { struct screen *s; struct tag *t; size_t i, n; struct conf_sec *sec, **ks, **mb; char *name, *tmp; int screenid; /* [tags] */ sec = fetch_section_first(NULL, "tags"); ks = fetch_section(sec, "tag"); n = fetch_section_count(ks); if (fetch_opt_first(sec, "1", "circular").boolean) W->flags |= WMFS_TAGCIRC; /* [mouse] */ if((mb = fetch_section(sec, "mouse"))) { config_mouse_section(&W->tmp_head.tag, mb); free(mb); } /* [tag] */ for(i = 0; i < n; ++i) { name = fetch_opt_first(ks[i], "tag", "name").str; screenid = fetch_opt_first(ks[i], "-1", "screen").num; SLIST_FOREACH(s, &W->h.screen, next) if(screenid == s->id || screenid == -1) { t = tag_new(s, name); t->statusctx = status_new_ctx(NULL, NULL); ISTRDUP(t->statusctx.status, fetch_opt_first(ks[i], "", "statusline").str); if(t->statusctx.status) status_parse(&t->statusctx); } } /* If no tag at all on a screen, add one anyway */ SLIST_FOREACH(s, &W->h.screen, next) if(TAILQ_EMPTY(&s->tags)) tag_new(s, "tag"); free(ks); }
static void config_theme(void) { struct theme *t, *p = NULL; size_t i, n; struct conf_sec *sec, **ks; char *tmp; /* [themes] */ sec = fetch_section_first(NULL, "themes"); ks = fetch_section(sec, "theme"); /* No theme section? Make one with default value anyway. */ if(!(n = fetch_section_count(ks))) ++n; SLIST_INIT(&W->h.theme); /* [theme]*/ for(i = 0; i < n; ++i) { t = (struct theme*)xcalloc(1, sizeof(struct theme)); t->name = fetch_opt_first(ks[i], "default", "name").str; wmfs_init_font(fetch_opt_first(ks[i], "fixed", "font").str, t); /* bars */ t->bars.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "bars_fg").str); t->bars.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "bars_bg").str); t->bars_width = fetch_opt_first(ks[i], "12", "bars_width").num; /* * Elements */ t->tags_n.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_normal_fg").str); t->tags_n.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_normal_bg").str); t->tags_s.fg = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_sel_fg").str); t->tags_s.bg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_sel_bg").str); t->tags_o.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_occupied_fg").str); t->tags_o.bg = color_atoh(fetch_opt_first(ks[i], "#444444", "tags_occupied_bg").str); t->tags_u.fg = color_atoh(fetch_opt_first(ks[i], "#444444", "tags_urgent_fg").str); t->tags_u.bg = color_atoh(fetch_opt_first(ks[i], "#CC4444", "tags_urgent_bg").str); t->tags_border_col = color_atoh(fetch_opt_first(ks[i], "#888888", "tags_border_color").str); t->tags_border_width = fetch_opt_first(ks[i], "0", "tags_border_width").num; /* status line */ t->tags_n_sl = status_new_ctx(NULL, t); t->tags_s_sl = status_new_ctx(NULL, t); t->tags_o_sl = status_new_ctx(NULL, t); t->tags_u_sl = status_new_ctx(NULL, t); ISTRDUP(t->tags_n_sl.status, fetch_opt_first(ks[i], "", "tags_normal_statusline").str); ISTRDUP(t->tags_s_sl.status, fetch_opt_first(ks[i], "", "tags_sel_statusline").str); ISTRDUP(t->tags_o_sl.status, fetch_opt_first(ks[i], "", "tags_occupied_statusline").str); ISTRDUP(t->tags_u_sl.status, fetch_opt_first(ks[i], "", "tags_urgent_statusline").str); if(t->tags_n_sl.status) status_parse(&t->tags_n_sl); if(t->tags_s_sl.status) status_parse(&t->tags_s_sl); if(t->tags_o_sl.status) status_parse(&t->tags_o_sl); if(t->tags_u_sl.status) status_parse(&t->tags_u_sl); /* Client / frame */ t->client_n.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "client_normal_fg").str); t->client_n.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "client_normal_bg").str); t->client_s.fg = color_atoh(fetch_opt_first(ks[i], "#222222", "client_sel_fg").str); t->client_s.bg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "client_sel_bg").str); t->frame_bg = color_atoh(fetch_opt_first(ks[i], "#555555", "frame_bg").str); t->client_titlebar_width = fetch_opt_first(ks[i], "12", "client_titlebar_width").num; t->client_border_width = fetch_opt_first(ks[i], "1", "client_border_width").num; /* status line */ t->client_n_sl = status_new_ctx(NULL, t); t->client_s_sl = status_new_ctx(NULL, t); ISTRDUP(t->client_n_sl.status, fetch_opt_first(ks[i], "", "client_normal_statusline").str); ISTRDUP(t->client_s_sl.status, fetch_opt_first(ks[i], "", "client_sel_statusline").str); if(t->client_n_sl.status) status_parse(&t->client_n_sl); if(t->client_s_sl.status) status_parse(&t->client_s_sl); SLIST_INSERT_TAIL(&W->h.theme, t, next, p); p = t; } free(ks); }