From 6fae35349a8b000b3445cb5de500c7a26eeb50a1 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 9 Nov 2007 14:45:43 +0100 Subject: [PATCH] Implement per screen configuration for statusbar. Others will come later. --- awesomerc | 7 +++++-- config.c | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/awesomerc b/awesomerc index b2ecd89f..b041a62c 100644 --- a/awesomerc +++ b/awesomerc @@ -21,9 +21,12 @@ colors tab_border = "#ff0000" } -statusbar +screen 0 { - position = "top" + statusbar + { + position = "top" + } } tags diff --git a/config.c b/config.c index 131ea69f..f07e485c 100644 --- a/config.c +++ b/config.c @@ -201,6 +201,10 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf) CFG_INT((char *) "ncol", 1, CFGF_NONE), CFG_END() }; + static cfg_opt_t screen_opts[] = + { + CFG_SEC((char *) "statusbar", statusbar_opts, CFGF_NONE), + }; static cfg_opt_t rule_opts[] = { CFG_STR((char *) "name", (char *) "", CFGF_NONE), @@ -231,19 +235,19 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf) { CFG_SEC((char *) "general", general_opts, CFGF_NONE), CFG_SEC((char *) "colors", colors_opts, CFGF_NONE), - CFG_SEC((char *) "statusbar", statusbar_opts, CFGF_NONE), + CFG_SEC((char *) "screen", screen_opts, CFGF_TITLE | CFGF_MULTI), CFG_SEC((char *) "tags", tags_opts, CFGF_NONE), CFG_SEC((char *) "layouts", layouts_opts, CFGF_NONE), CFG_SEC((char *) "rules", rules_opts, CFGF_NONE), CFG_SEC((char *) "keys", keys_opts, CFGF_NONE), CFG_END() }; - cfg_t *cfg, *cfg_general, *cfg_colors, *cfg_statusbar, + cfg_t *cfg, *cfg_general, *cfg_colors, *cfg_screen, *cfg_statusbar, *cfg_tags, *cfg_layouts, *cfg_rules, *cfg_keys, *cfgsectmp; int i = 0, k = 0, ret; unsigned int j = 0; const char *tmp, *homedir; - char *confpath; + char *confpath, buf[2]; KeySym tmp_key; ssize_t confpath_len; @@ -273,9 +277,18 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf) else if(ret == CFG_PARSE_ERROR) cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath); + /* get the right screen section */ + snprintf(buf, sizeof(buf), "%d", awesomeconf->screen); + cfg_screen = cfg_gettsec(cfg, "screen", buf); + if(!cfg_screen) + cfg_screen = cfg_getsec(cfg, "screen"); + + /* get screen specific sections */ + cfg_statusbar = cfg_getsec(cfg_screen, "statusbar"); + + /* get general sections */ cfg_general = cfg_getsec(cfg, "general"); cfg_colors = cfg_getsec(cfg, "colors"); - cfg_statusbar = cfg_getsec(cfg, "statusbar"); cfg_tags = cfg_getsec(cfg, "tags"); cfg_layouts = cfg_getsec(cfg, "layouts"); cfg_rules = cfg_getsec(cfg, "rules");