[wmfs.c,.h config.c] Fix tag config property bug
This commit is contained in:
parent
969b9a1627
commit
b8cb665a9a
30
config.c
30
config.c
@ -32,7 +32,7 @@
|
||||
|
||||
#include "wmfs.h"
|
||||
|
||||
#define FILE_NAME ".wmfsrc"
|
||||
#define FILE_NAME ".config/wmfs/wmfsrc"
|
||||
|
||||
func_name_list_t func_list[] =
|
||||
{
|
||||
@ -241,23 +241,19 @@ init_conf(void)
|
||||
cfg_t *cfg_buttons;
|
||||
cfg_t *cfgtmp, *cfgtmp2, *cfgtmp3;
|
||||
char final_path[128];
|
||||
char sfinal_path[128];
|
||||
int ret, i, j, l;
|
||||
|
||||
sprintf(final_path,"%s/%s",strdup(getenv("HOME")),strdup(FILE_NAME));
|
||||
|
||||
cfg = cfg_init(opts, CFGF_NONE);
|
||||
|
||||
ret = cfg_parse(cfg, final_path);
|
||||
|
||||
if(ret == CFG_FILE_ERROR)
|
||||
if(ret == CFG_FILE_ERROR || ret == CFG_PARSE_ERROR)
|
||||
{
|
||||
printf("WMFS: parsing configuration file failed\n");
|
||||
exit(1);
|
||||
}
|
||||
else if(ret == CFG_PARSE_ERROR)
|
||||
{
|
||||
cfg_error(cfg, "WMFS: parsing configuration file %s failed.\n", final_path);
|
||||
exit(1);
|
||||
printf("WMFS: parsing configuration file (%s) failed\n", final_path);
|
||||
sprintf(sfinal_path, "%s/wmfs/wmfsrc", XDG_CONFIG_DIR);
|
||||
ret = cfg_parse(cfg, sfinal_path);
|
||||
}
|
||||
|
||||
cfg_misc = cfg_getsec(cfg, "misc");
|
||||
@ -296,15 +292,17 @@ init_conf(void)
|
||||
|
||||
/* tag */
|
||||
conf.ntag = cfg_size(cfg_tags, "tag");
|
||||
for(i = 0; i < conf.ntag + 1; ++i)
|
||||
for(i = 0; i < cfg_size(cfg_tags, "tag"); ++i)
|
||||
{
|
||||
cfgtmp = cfg_getnsec(cfg_tags, "tag", ((i == conf.ntag) ? conf.ntag - 1 : i));
|
||||
tags[i].name = strdup(cfg_getstr(cfgtmp, "name"));
|
||||
tags[i].mwfact = cfg_getfloat(cfgtmp, "mwfact");
|
||||
tags[i].nmaster = cfg_getint(cfgtmp, "nmaster");
|
||||
tags[i].layout.func = layout_name_to_layout(cfg_getstr(cfgtmp, "layout"));
|
||||
cfgtmp = cfg_getnsec(cfg_tags, "tag", i);
|
||||
conf.tag[i].name = strdup(cfg_getstr(cfgtmp, "name"));
|
||||
conf.tag[i].mwfact = cfg_getfloat(cfgtmp, "mwfact");
|
||||
conf.tag[i].nmaster = cfg_getint(cfgtmp, "nmaster");
|
||||
conf.tag[i].layout.func = layout_name_to_layout(cfg_getstr(cfgtmp, "layout"));
|
||||
}
|
||||
|
||||
debug(tags[1].mwfact);
|
||||
|
||||
/* keybind ('tention ça rigole plus) */
|
||||
conf.nkeybind = cfg_size(cfg_keys, "key");
|
||||
for(j = 0; j < cfg_size(cfg_keys, "key"); ++j)
|
||||
|
||||
18
wmfs.c
18
wmfs.c
@ -294,9 +294,18 @@ init(void)
|
||||
root = RootWindow (dpy, screen);
|
||||
mw = DisplayWidth (dpy, screen);
|
||||
mh = DisplayHeight (dpy, screen);
|
||||
seltag = 1;
|
||||
taglen[0] = 3;
|
||||
|
||||
/* INIT TAG / LAYOUT ATTRIBUTE */
|
||||
seltag = 1;
|
||||
for(i = 0; i < conf.ntag + 1; ++i)
|
||||
{
|
||||
tags[i].nmaster = conf.tag[i-1].nmaster;
|
||||
tags[i].mwfact = conf.tag[i-1].mwfact;
|
||||
tags[i].name = conf.tag[i-1].name;
|
||||
tags[i].layout.func = conf.tag[i-1].layout.func;
|
||||
}
|
||||
|
||||
/* INIT FONT */
|
||||
font = XLoadQueryFont(dpy, conf.font);
|
||||
if(!font)
|
||||
@ -954,6 +963,7 @@ tile(void)
|
||||
c->tile = True;
|
||||
c->ox = c->x; c->oy = c->y;
|
||||
c->ow = c->w; c->oh = c->h;
|
||||
|
||||
/* MASTER CLIENT */
|
||||
if(i < nm)
|
||||
{
|
||||
@ -1115,9 +1125,9 @@ updatebar(void)
|
||||
{
|
||||
/* Make the tags string */
|
||||
ITOA(p, clientpertag(i+1));
|
||||
sprintf(buf[i], "%s<%s> ", tags[i].name, (clientpertag(i+1)) ? p : "");
|
||||
taglen[i+1] = (taglen[i] + fonty * (strlen(tags[i].name) +
|
||||
strlen(buf[i]) - strlen(tags[i].name)) + fonty) - 2;
|
||||
sprintf(buf[i], "%s<%s> ", tags[i+1].name , (clientpertag(i+1)) ? p : "");
|
||||
taglen[i+1] = (taglen[i] + fonty * (strlen( tags[i+1].name ) +
|
||||
strlen(buf[i]) - strlen(tags[i+1].name)) + fonty) - 2;
|
||||
/* Rectangle for the tag background */
|
||||
XSetForeground(dpy, gc, (i+1 == seltag) ? conf.colors.tagselbg : conf.colors.bar);
|
||||
XFillRectangle(dpy, dr, gc, taglen[i] - 3, 0, (strlen(buf[i])*fonty) -2, barheight);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user