diff options
author | okan <okan> | 2009-05-17 23:40:57 +0000 |
---|---|---|
committer | okan <okan> | 2009-05-17 23:40:57 +0000 |
commit | 4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d (patch) | |
tree | 1981b9b6d512a7bfdf07dbe8c7e957de0e004d61 /parse.y | |
parent | 5d51c8e0e541449093913ff3b1f78989c82ed035 (diff) | |
download | cwm-4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d.tar.gz cwm-4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d.tar.xz cwm-4d5dc5d9ea24d1b856c8b8c13c36a16daa396a4d.zip |
a long time coming - re-work the way we deal with colors: since we're
using Xft(3), use it to select the font color as well instead of trying to build one; properly allocate and free colors at-will, e.g. we now have configurable colors. feedback and ok's todd@ and oga@
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/parse.y b/parse.y index 2554ed3..272b587 100644 --- a/parse.y +++ b/parse.y @@ -67,6 +67,9 @@ typedef struct { %token FONTNAME STICKY GAP MOUSEBIND %token AUTOGROUP BIND COMMAND IGNORE %token YES NO BORDERWIDTH MOVEAMOUNT +%token COLOR +%token ACTIVEBORDER INACTIVEBORDER +%token GROUPBORDER UNGROUPBORDER %token ERROR %token <v.string> STRING %token <v.number> NUMBER @@ -77,6 +80,7 @@ typedef struct { grammar : /* empty */ | grammar '\n' | grammar main '\n' + | grammar color '\n' | grammar error '\n' { file->errors++; } ; @@ -170,6 +174,27 @@ main : FONTNAME STRING { free($3); } ; + +color : COLOR colors + ; + +colors : ACTIVEBORDER STRING { + free(conf->color[CWM_COLOR_BORDOR_ACTIVE].name); + conf->color[CWM_COLOR_BORDOR_ACTIVE].name = $2; + } + | INACTIVEBORDER STRING { + free(conf->color[CWM_COLOR_BORDER_INACTIVE].name); + conf->color[CWM_COLOR_BORDER_INACTIVE].name = $2; + } + | GROUPBORDER STRING { + free(conf->color[CWM_COLOR_BORDER_GROUP].name); + conf->color[CWM_COLOR_BORDER_GROUP].name = $2; + } + | UNGROUPBORDER STRING { + free(conf->color[CWM_COLOR_BORDER_UNGROUP].name); + conf->color[CWM_COLOR_BORDER_UNGROUP].name = $2; + } + ; %% struct keywords { @@ -202,17 +227,22 @@ lookup(char *s) { /* this has to be sorted always */ static const struct keywords keywords[] = { + { "activeborder", ACTIVEBORDER}, { "autogroup", AUTOGROUP}, { "bind", BIND}, { "borderwidth", BORDERWIDTH}, + { "color", COLOR}, { "command", COMMAND}, { "fontname", FONTNAME}, { "gap", GAP}, + { "groupborder", GROUPBORDER}, { "ignore", IGNORE}, + { "inactiveborder", INACTIVEBORDER}, { "mousebind", MOUSEBIND}, { "moveamount", MOVEAMOUNT}, { "no", NO}, { "sticky", STICKY}, + { "ungroupborder", UNGROUPBORDER}, { "yes", YES} }; const struct keywords *p; @@ -498,6 +528,7 @@ parse_config(const char *filename, struct conf *xconf) struct winmatch *wm; struct cmd *cmd; struct mousebinding *mb; + int i; conf_clear(xconf); @@ -535,6 +566,9 @@ parse_config(const char *filename, struct conf *xconf) strlcpy(xconf->lockpath, conf->lockpath, sizeof(xconf->lockpath)); + for (i = 0; i < CWM_COLOR_MAX; i++) + xconf->color[i].name = conf->color[i].name; + xconf->DefaultFontName = conf->DefaultFontName; bcopy(&(conf->gap_top), &(xconf->gap_top), sizeof(int) * 4); |