add new awesome-check program to check configuration file syntax

This commit is contained in:
Julien Danjou 2008-01-30 14:07:14 +01:00
parent 606d157e31
commit 10f9106e4e
7 changed files with 366 additions and 257 deletions

1
.gitignore vendored
View File

@ -24,3 +24,4 @@ widgetgen.h
layoutgen.h layoutgen.h
awesome-version-internal.h awesome-version-internal.h
awesome-message awesome-message
awesome-check

View File

@ -36,6 +36,7 @@ WIDGETS += widgets/graph.c
doc_DATA += README doc_DATA += README
doc_DATA += UPGRADE
EXTRA_DIST += LICENSE EXTRA_DIST += LICENSE
@ -130,7 +131,8 @@ awesome_SOURCES = \
widget.c widget.h \ widget.c widget.h \
ewmh.c ewmh.h \ ewmh.c ewmh.h \
common/list.h structs.h \ common/list.h structs.h \
common/awclient.h common/awclient.h \
common/configopts.h
awesome_SOURCES += $(LAYOUTS) awesome_SOURCES += $(LAYOUTS)
awesome_SOURCES += $(WIDGETS) awesome_SOURCES += $(WIDGETS)
awesome_LDADD = $(XFT_LIBS) $(X_LIBS) $(CAIRO_LIBS) $(CONFUSE_LIBS) $(XRANDR_LIBS) $(XINERAMA_LIBS) awesome_LDADD = $(XFT_LIBS) $(X_LIBS) $(CAIRO_LIBS) $(CONFUSE_LIBS) $(XRANDR_LIBS) $(XINERAMA_LIBS)
@ -152,6 +154,14 @@ awesome_message_SOURCES = \
awesome_message_LDADD = $(XFT_LIBS) $(X_LIBS) $(CAIRO_LIBS) awesome_message_LDADD = $(XFT_LIBS) $(X_LIBS) $(CAIRO_LIBS)
bin_PROGRAMS += awesome-check
awesome_check_SOURCES = \
awesome-check.c common/configopts.h \
common/util.h common/util.c \
common/awesome-version.h common/awesome-version.c
awesome_check_LDADD = $(CONFUSE_LIBS)
EXTRA_DIST += awesome.1.txt EXTRA_DIST += awesome.1.txt
man_MANS += awesome.1 man_MANS += awesome.1

1
README
View File

@ -1,7 +1,6 @@
awesome awesome
======= =======
awesome is an extremely fast, small, and dynamic window manager for X. awesome is an extremely fast, small, and dynamic window manager for X.
It's based on dwm.
Requirements Requirements
------------ ------------

1
UPGRADE Normal file
View File

@ -0,0 +1 @@
Run awesome-check to check your configuration file syntax.

94
awesome-check.c Normal file
View File

@ -0,0 +1,94 @@
/*
* awesome-check.c - awesome configuration file testing
*
* Copyright © 2008 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <confuse.h>
#include "common/awesome-version.h"
#include "common/util.h"
#include "common/configopts.h"
#define PROGNAME "awesome-check"
/** Print help and exit(2) with given exit_code.
*/
static void __attribute__ ((noreturn))
exit_help(int exit_code)
{
FILE *outfile = (exit_code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(outfile, "Usage: %s [-v | -h | -c configfile]\n", PROGNAME);
exit(exit_code);
}
int
main(int argc, char *argv[])
{
cfg_t *cfg;
char *confpath = NULL;
const char *homedir = NULL;
int args_ok = 1, ret;
ssize_t confpath_len;
/* check args */
if(argc >= 2)
{
args_ok = 0;
if(!a_strcmp("-v", argv[1]) || !a_strcmp("--version", argv[1]))
eprint_version(PROGNAME);
else if(!a_strcmp("-h", argv[1]) || !a_strcmp("--help", argv[1]))
exit_help(EXIT_SUCCESS);
else if(!a_strcmp("-c", argv[1]))
{
if(a_strlen(argv[2]))
confpath = argv[2], args_ok = 1;
else
eprint("-c option requires a file name\n");
}
else
exit_help(EXIT_FAILURE);
}
if(!args_ok)
exit_help(EXIT_FAILURE);
if(!confpath)
{
homedir = getenv("HOME");
confpath_len = a_strlen(homedir) + a_strlen(AWESOME_CONFIG_FILE) + 2;
confpath = p_new(char, confpath_len);
a_strcpy(confpath, confpath_len, homedir);
a_strcat(confpath, confpath_len, "/");
a_strcat(confpath, confpath_len, AWESOME_CONFIG_FILE);
}
cfg = cfg_init(opts, CFGF_NONE);
switch((ret = cfg_parse(cfg, confpath)))
{
case CFG_FILE_ERROR:
perror("awesome: parsing configuration file failed");
break;
case CFG_PARSE_ERROR:
cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath);
break;
}
return ret;
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

258
common/configopts.h Normal file
View File

@ -0,0 +1,258 @@
#include "rules.h"
#define AWESOME_CONFIG_FILE ".awesomerc"
static cfg_opt_t general_opts[] =
{
CFG_INT((char *) "border", 1, CFGF_NONE),
CFG_INT((char *) "snap", 8, CFGF_NONE),
CFG_BOOL((char *) "resize_hints", cfg_true, CFGF_NONE),
CFG_BOOL((char *) "sloppy_focus", cfg_true, CFGF_NONE),
CFG_BOOL((char *) "sloppy_focus_raise", cfg_false, CFGF_NONE),
CFG_BOOL((char *) "new_become_master", cfg_true, CFGF_NONE),
CFG_BOOL((char *) "new_get_focus", cfg_true, CFGF_NONE),
CFG_STR((char *) "font", (char *) "vera-10", CFGF_NONE),
CFG_END()
};
static cfg_opt_t colors_opts[] =
{
CFG_STR((char *) "normal_border", (char *) "#111111", CFGF_NONE),
CFG_STR((char *) "normal_bg", (char *) "#111111", CFGF_NONE),
CFG_STR((char *) "normal_fg", (char *) "#eeeeee", CFGF_NONE),
CFG_STR((char *) "focus_border", (char *) "#6666ff", CFGF_NONE),
CFG_STR((char *) "focus_bg", (char *) "#6666ff", CFGF_NONE),
CFG_STR((char *) "focus_fg", (char *) "#ffffff", CFGF_NONE),
CFG_STR((char *) "urgent_bg", (char *) "#ff0000", CFGF_NONE),
CFG_STR((char *) "urgent_fg", (char *) "#ffffff", CFGF_NONE),
CFG_STR((char *) "tab_border", (char *) "#ff0000", CFGF_NONE),
CFG_END()
};
static cfg_opt_t mouse_taglist_opts[] =
{
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
CFG_STR((char *) "button", (char *) "None", CFGF_NONE),
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
CFG_END()
};
static cfg_opt_t mouse_generic_opts[] =
{
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
CFG_STR((char *) "button", (char *) "None", CFGF_NONE),
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
CFG_STR((char *) "arg", NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t widget_taglist_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_taglist_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t widget_iconbox_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_STR((char *) "image", (char *) NULL, CFGF_NONE),
CFG_BOOL((char *) "resize", cfg_true, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_textbox_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_INT((char *) "width", 0, CFGF_NONE),
CFG_STR((char *) "text", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "font", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "align", (char *) "center", CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_focustitle_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "font", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "align", (char *) "left", CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_tasklist_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "focus_fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "focus_bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "font", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "align", (char *) "left", CFGF_NONE),
CFG_BOOL((char *) "show_icons", cfg_true, CFGF_NONE),
CFG_BOOL((char *) "show_all", cfg_false, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_graph_data_opts[] =
{
CFG_FLOAT((char *) "max", 100.0f, CFGF_NONE),
CFG_BOOL((char *) "scale", cfg_false, CFGF_NONE),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "style", (char *) "bottom", CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_graph_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "data", widget_graph_data_opts, CFGF_MULTI),
CFG_INT((char *) "width", 100, CFGF_NONE),
CFG_INT((char *) "padding_left", 0, CFGF_NONE),
CFG_FLOAT((char *) "height", 0.67, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bordercolor", (char *) NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_progressbar_bar_opts[] =
{
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bordercolor", (char *) NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_progressbar_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "bar", widget_progressbar_bar_opts, CFGF_MULTI),
CFG_INT((char *) "width", 100, CFGF_NONE),
CFG_INT((char *) "gap", 2, CFGF_NONE),
CFG_INT((char *) "padding", 0, CFGF_NONE),
CFG_FLOAT((char *) "height", 0.67, CFGF_NONE),
CFG_END()
};
static cfg_opt_t statusbar_opts[] =
{
CFG_STR((char *) "position", (char *) "top", CFGF_NONE),
CFG_INT((char *) "height", 0, CFGF_NONE),
CFG_INT((char *) "width", 0, CFGF_NONE),
CFG_SEC((char *) "textbox", widget_textbox_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "taglist", widget_taglist_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "focustitle", widget_focustitle_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "layoutinfo", widget_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "iconbox", widget_iconbox_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "netwmicon", widget_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "progressbar", widget_progressbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "graph", widget_graph_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "tasklist", widget_tasklist_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_END()
};
static cfg_opt_t tag_opts[] =
{
CFG_STR((char *) "layout", (char *) "tile", CFGF_NONE),
CFG_FLOAT((char *) "mwfact", 0.5, CFGF_NONE),
CFG_INT((char *) "nmaster", 1, CFGF_NONE),
CFG_INT((char *) "ncol", 1, CFGF_NONE),
CFG_END()
};
static cfg_opt_t tags_opts[] =
{
CFG_SEC((char *) "tag", tag_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_END()
};
static cfg_opt_t layout_opts[] =
{
CFG_STR((char *) "image", NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t layouts_opts[] =
{
CFG_SEC((char *) "layout", layout_opts, CFGF_TITLE | CFGF_MULTI),
CFG_END()
};
static cfg_opt_t padding_opts[] =
{
CFG_INT((char *) "top", 0, CFGF_NONE),
CFG_INT((char *) "bottom", 0, CFGF_NONE),
CFG_INT((char *) "right", 0, CFGF_NONE),
CFG_INT((char *) "left", 0, CFGF_NONE),
CFG_END()
};
static cfg_opt_t screen_opts[] =
{
CFG_SEC((char *) "general", general_opts, CFGF_NONE),
CFG_SEC((char *) "statusbar", statusbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "tags", tags_opts, CFGF_NONE),
CFG_SEC((char *) "colors", colors_opts, CFGF_NONE),
CFG_SEC((char *) "layouts", layouts_opts, CFGF_NONE),
CFG_SEC((char *) "padding", padding_opts, CFGF_NONE),
CFG_END()
};
static cfg_opt_t rule_opts[] =
{
CFG_STR((char *) "xproperty_name", NULL, CFGF_NONE),
CFG_STR((char *) "xproperty_value", NULL, CFGF_NONE),
CFG_STR((char *) "name", NULL, CFGF_NONE),
CFG_STR((char *) "tags", NULL, CFGF_NONE),
CFG_STR((char *) "icon", NULL, CFGF_NONE),
CFG_STR((char *) "float", (char *) "auto", CFGF_NONE),
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
CFG_BOOL((char *) "not_master", cfg_false, CFGF_NONE),
CFG_FLOAT((char *) "opacity", -1.0f, CFGF_NONE),
CFG_END()
};
static cfg_opt_t rules_opts[] =
{
CFG_SEC((char *) "rule", rule_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t key_opts[] =
{
CFG_STR_LIST((char *) "modkey", (char *) "{Mod4}", CFGF_NONE),
CFG_STR((char *) "key", (char *) "None", CFGF_NONE),
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
CFG_STR((char *) "arg", NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t keylist_opts[] =
{
CFG_STR_LIST((char *) "modkey", (char *) "{Mod4}", CFGF_NONE),
CFG_STR_LIST((char *) "keylist", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
CFG_STR_LIST((char *) "arglist", NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t keys_opts[] =
{
CFG_SEC((char *) "key", key_opts, CFGF_MULTI),
CFG_SEC((char *) "keylist", keylist_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t mouse_opts[] =
{
CFG_SEC((char *) "root", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "client", mouse_generic_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t opts[] =
{
CFG_SEC((char *) "screen", screen_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "rules", rules_opts, CFGF_NONE),
CFG_SEC((char *) "keys", keys_opts, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_opts, CFGF_NONE),
CFG_END()
};
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

256
config.c
View File

@ -35,8 +35,7 @@
#include "ewmh.h" #include "ewmh.h"
#include "defconfig.h" #include "defconfig.h"
#include "layouts/tile.h" #include "layouts/tile.h"
#include "common/configopts.h"
#define AWESOME_CONFIG_FILE ".awesomerc"
/* Permit to use mouse with many more buttons */ /* Permit to use mouse with many more buttons */
#ifndef Button6 #ifndef Button6
@ -435,259 +434,6 @@ config_parse_screen(cfg_t *cfg, int screen)
void void
config_parse(const char *confpatharg) config_parse(const char *confpatharg)
{ {
static cfg_opt_t general_opts[] =
{
CFG_INT((char *) "border", 1, CFGF_NONE),
CFG_INT((char *) "snap", 8, CFGF_NONE),
CFG_BOOL((char *) "resize_hints", cfg_true, CFGF_NONE),
CFG_BOOL((char *) "sloppy_focus", cfg_true, CFGF_NONE),
CFG_BOOL((char *) "sloppy_focus_raise", cfg_false, CFGF_NONE),
CFG_BOOL((char *) "new_become_master", cfg_true, CFGF_NONE),
CFG_BOOL((char *) "new_get_focus", cfg_true, CFGF_NONE),
CFG_STR((char *) "font", (char *) "vera-10", CFGF_NONE),
CFG_END()
};
static cfg_opt_t colors_opts[] =
{
CFG_STR((char *) "normal_border", (char *) "#111111", CFGF_NONE),
CFG_STR((char *) "normal_bg", (char *) "#111111", CFGF_NONE),
CFG_STR((char *) "normal_fg", (char *) "#eeeeee", CFGF_NONE),
CFG_STR((char *) "focus_border", (char *) "#6666ff", CFGF_NONE),
CFG_STR((char *) "focus_bg", (char *) "#6666ff", CFGF_NONE),
CFG_STR((char *) "focus_fg", (char *) "#ffffff", CFGF_NONE),
CFG_STR((char *) "urgent_bg", (char *) "#ff0000", CFGF_NONE),
CFG_STR((char *) "urgent_fg", (char *) "#ffffff", CFGF_NONE),
CFG_STR((char *) "tab_border", (char *) "#ff0000", CFGF_NONE),
CFG_END()
};
static cfg_opt_t mouse_taglist_opts[] =
{
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
CFG_STR((char *) "button", (char *) "None", CFGF_NONE),
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
CFG_END()
};
static cfg_opt_t mouse_generic_opts[] =
{
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
CFG_STR((char *) "button", (char *) "None", CFGF_NONE),
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
CFG_STR((char *) "arg", NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t widget_taglist_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_taglist_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t widget_iconbox_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_STR((char *) "image", (char *) NULL, CFGF_NONE),
CFG_BOOL((char *) "resize", cfg_true, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_textbox_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_INT((char *) "width", 0, CFGF_NONE),
CFG_STR((char *) "text", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "font", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "align", (char *) "center", CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_focustitle_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "font", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "align", (char *) "left", CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_tasklist_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "focus_fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "focus_bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "font", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "align", (char *) "left", CFGF_NONE),
CFG_BOOL((char *) "show_icons", cfg_true, CFGF_NONE),
CFG_BOOL((char *) "show_all", cfg_false, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_graph_data_opts[] =
{
CFG_FLOAT((char *) "max", 100.0f, CFGF_NONE),
CFG_BOOL((char *) "scale", cfg_false, CFGF_NONE),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "style", (char *) "bottom", CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_graph_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "data", widget_graph_data_opts, CFGF_MULTI),
CFG_INT((char *) "width", 100, CFGF_NONE),
CFG_INT((char *) "padding_left", 0, CFGF_NONE),
CFG_FLOAT((char *) "height", 0.67, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bordercolor", (char *) NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_progressbar_bar_opts[] =
{
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bordercolor", (char *) NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t widget_progressbar_opts[] =
{
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "bar", widget_progressbar_bar_opts, CFGF_MULTI),
CFG_INT((char *) "width", 100, CFGF_NONE),
CFG_INT((char *) "gap", 2, CFGF_NONE),
CFG_INT((char *) "padding", 0, CFGF_NONE),
CFG_FLOAT((char *) "height", 0.67, CFGF_NONE),
CFG_END()
};
static cfg_opt_t statusbar_opts[] =
{
CFG_STR((char *) "position", (char *) "top", CFGF_NONE),
CFG_INT((char *) "height", 0, CFGF_NONE),
CFG_INT((char *) "width", 0, CFGF_NONE),
CFG_SEC((char *) "textbox", widget_textbox_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "taglist", widget_taglist_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "focustitle", widget_focustitle_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "layoutinfo", widget_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "iconbox", widget_iconbox_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "netwmicon", widget_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "progressbar", widget_progressbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "graph", widget_graph_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "tasklist", widget_tasklist_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_END()
};
static cfg_opt_t tag_opts[] =
{
CFG_STR((char *) "layout", (char *) "tile", CFGF_NONE),
CFG_FLOAT((char *) "mwfact", 0.5, CFGF_NONE),
CFG_INT((char *) "nmaster", 1, CFGF_NONE),
CFG_INT((char *) "ncol", 1, CFGF_NONE),
CFG_END()
};
static cfg_opt_t tags_opts[] =
{
CFG_SEC((char *) "tag", tag_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_END()
};
static cfg_opt_t layout_opts[] =
{
CFG_STR((char *) "image", NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t layouts_opts[] =
{
CFG_SEC((char *) "layout", layout_opts, CFGF_TITLE | CFGF_MULTI),
CFG_END()
};
static cfg_opt_t padding_opts[] =
{
CFG_INT((char *) "top", 0, CFGF_NONE),
CFG_INT((char *) "bottom", 0, CFGF_NONE),
CFG_INT((char *) "right", 0, CFGF_NONE),
CFG_INT((char *) "left", 0, CFGF_NONE),
CFG_END()
};
static cfg_opt_t screen_opts[] =
{
CFG_SEC((char *) "general", general_opts, CFGF_NONE),
CFG_SEC((char *) "statusbar", statusbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "tags", tags_opts, CFGF_NONE),
CFG_SEC((char *) "colors", colors_opts, CFGF_NONE),
CFG_SEC((char *) "layouts", layouts_opts, CFGF_NONE),
CFG_SEC((char *) "padding", padding_opts, CFGF_NONE),
CFG_END()
};
static cfg_opt_t rule_opts[] =
{
CFG_STR((char *) "xproperty_name", NULL, CFGF_NONE),
CFG_STR((char *) "xproperty_value", NULL, CFGF_NONE),
CFG_STR((char *) "name", NULL, CFGF_NONE),
CFG_STR((char *) "tags", NULL, CFGF_NONE),
CFG_STR((char *) "icon", NULL, CFGF_NONE),
CFG_STR((char *) "float", (char *) "auto", CFGF_NONE),
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
CFG_BOOL((char *) "not_master", cfg_false, CFGF_NONE),
CFG_FLOAT((char *) "opacity", -1.0f, CFGF_NONE),
CFG_END()
};
static cfg_opt_t rules_opts[] =
{
CFG_SEC((char *) "rule", rule_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t key_opts[] =
{
CFG_STR_LIST((char *) "modkey", (char *) "{Mod4}", CFGF_NONE),
CFG_STR((char *) "key", (char *) "None", CFGF_NONE),
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
CFG_STR((char *) "arg", NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t keylist_opts[] =
{
CFG_STR_LIST((char *) "modkey", (char *) "{Mod4}", CFGF_NONE),
CFG_STR_LIST((char *) "keylist", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
CFG_STR_LIST((char *) "arglist", NULL, CFGF_NONE),
CFG_END()
};
static cfg_opt_t keys_opts[] =
{
CFG_SEC((char *) "key", key_opts, CFGF_MULTI),
CFG_SEC((char *) "keylist", keylist_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t mouse_opts[] =
{
CFG_SEC((char *) "root", mouse_generic_opts, CFGF_MULTI),
CFG_SEC((char *) "client", mouse_generic_opts, CFGF_MULTI),
CFG_END()
};
static cfg_opt_t opts[] =
{
CFG_SEC((char *) "screen", screen_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "rules", rules_opts, CFGF_NONE),
CFG_SEC((char *) "keys", keys_opts, CFGF_NONE),
CFG_SEC((char *) "mouse", mouse_opts, CFGF_NONE),
CFG_END()
};
cfg_t *cfg, *cfg_rules, *cfg_keys, *cfg_mouse, *cfgsectmp; cfg_t *cfg, *cfg_rules, *cfg_keys, *cfg_mouse, *cfgsectmp;
int ret, screen, i; int ret, screen, i;
const char *homedir; const char *homedir;