2008-01-31 16:34:00 +01:00
|
|
|
/*
|
|
|
|
* configopts.c - configuration options
|
|
|
|
*
|
|
|
|
* Copyright © 2007-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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-03-09 18:31:16 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2008-01-31 16:34:00 +01:00
|
|
|
#include <confuse.h>
|
|
|
|
|
|
|
|
#include "rules.h"
|
|
|
|
#include "common/configopts.h"
|
|
|
|
|
|
|
|
#define AWESOME_CONFIG_FILE ".awesomerc"
|
|
|
|
|
2008-02-29 09:54:03 +01:00
|
|
|
#define CFG_AWESOME_END() \
|
2008-03-09 18:31:16 +01:00
|
|
|
CFG_FUNC((char *) "include", cfg_awesome_include), \
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_END()
|
|
|
|
|
2008-03-19 11:15:58 +01:00
|
|
|
#define CFG_POSITION(name, value, flags) \
|
|
|
|
CFG_PTR_CB(name, value, flags, \
|
|
|
|
cfg_position_parse, cfg_value_free)
|
|
|
|
|
2008-03-19 11:45:27 +01:00
|
|
|
#define CFG_ALIGNMENT(name, value, flags) \
|
|
|
|
CFG_PTR_CB(name, value, flags, \
|
|
|
|
cfg_alignment_parse, cfg_value_free)
|
|
|
|
|
2008-03-09 18:31:16 +01:00
|
|
|
/** This is a better writing of cfg_include coming from libconfuse.
|
|
|
|
* With this one, we do not treat errors as fatal.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
cfg_awesome_include(cfg_t *cfg, cfg_opt_t *opt,
|
|
|
|
int argc, const char **argv)
|
|
|
|
{
|
2008-03-09 20:01:32 +01:00
|
|
|
char *filename;
|
2008-03-09 18:31:16 +01:00
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
if(argc != 1 || !a_strlen(argv[0]))
|
|
|
|
{
|
|
|
|
cfg_error(cfg, "wrong number of arguments to cfg_awesome_include()");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-09 20:01:32 +01:00
|
|
|
filename = cfg_tilde_expand(argv[0]);
|
|
|
|
|
|
|
|
if(!(fp = fopen(filename, "r")))
|
2008-03-09 18:31:16 +01:00
|
|
|
{
|
2008-03-09 20:01:32 +01:00
|
|
|
cfg_error(cfg, "cannot include configuration file %s: %s",
|
|
|
|
filename, strerror(errno));
|
2008-03-09 18:31:16 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-09 20:01:32 +01:00
|
|
|
p_delete(&filename);
|
2008-03-09 18:31:16 +01:00
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
return cfg_include(cfg, opt, argc, argv);
|
|
|
|
}
|
|
|
|
|
2008-03-19 11:15:58 +01:00
|
|
|
static int
|
|
|
|
cfg_position_parse(cfg_t *cfg, cfg_opt_t *opt,
|
|
|
|
const char *value, void *result)
|
|
|
|
{
|
2008-04-11 11:19:23 +02:00
|
|
|
position_t *p = p_new(position_t, 1);
|
2008-04-09 13:26:02 +02:00
|
|
|
|
2008-03-19 11:15:58 +01:00
|
|
|
if((*p = position_get_from_str(value)) == Off
|
|
|
|
&& a_strcmp(value, "off"))
|
|
|
|
{
|
|
|
|
cfg_error(cfg,
|
|
|
|
"position option '%s' must be top, bottom, right, left, auto or off in section '%s'",
|
|
|
|
opt->name, cfg->name);
|
|
|
|
p_delete(&p);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
*(void **) result = p;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-19 11:45:27 +01:00
|
|
|
static int
|
|
|
|
cfg_alignment_parse(cfg_t *cfg, cfg_opt_t *opt,
|
|
|
|
const char *value, void *result)
|
|
|
|
{
|
2008-04-11 11:18:23 +02:00
|
|
|
alignment_t *p = p_new(alignment_t, 1);
|
2008-04-09 13:26:02 +02:00
|
|
|
|
2008-03-19 11:45:27 +01:00
|
|
|
if((*p = draw_align_get_from_str(value)) == Auto
|
|
|
|
&& a_strcmp(value, "auto"))
|
|
|
|
{
|
|
|
|
cfg_error(cfg,
|
|
|
|
"alignment option '%s' must be left, center, right, flex or auto in section '%s'",
|
|
|
|
opt->name, cfg->name);
|
|
|
|
p_delete(&p);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
*(void **) result = p;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-19 11:15:58 +01:00
|
|
|
static void
|
|
|
|
cfg_value_free(void *value)
|
|
|
|
{
|
|
|
|
p_delete(&value);
|
|
|
|
}
|
|
|
|
|
2008-04-11 11:18:23 +02:00
|
|
|
alignment_t
|
2008-03-19 12:05:36 +01:00
|
|
|
cfg_opt_getnalignment(cfg_opt_t *opt, unsigned int oindex)
|
|
|
|
{
|
2008-04-11 11:18:23 +02:00
|
|
|
return * (alignment_t *) cfg_opt_getnptr(opt, oindex);
|
2008-03-19 12:05:36 +01:00
|
|
|
}
|
|
|
|
|
2008-04-11 11:18:23 +02:00
|
|
|
alignment_t
|
2008-03-19 12:05:36 +01:00
|
|
|
cfg_getnalignment(cfg_t *cfg, const char *name, unsigned int oindex)
|
|
|
|
{
|
|
|
|
return cfg_opt_getnalignment(cfg_getopt(cfg, name), oindex);
|
|
|
|
}
|
|
|
|
|
2008-04-11 11:18:23 +02:00
|
|
|
alignment_t
|
2008-03-19 12:05:36 +01:00
|
|
|
cfg_getalignment(cfg_t *cfg, const char *name)
|
|
|
|
{
|
|
|
|
return cfg_getnalignment(cfg, name, 0);
|
|
|
|
}
|
|
|
|
|
2008-04-11 11:19:23 +02:00
|
|
|
position_t
|
2008-03-19 11:58:43 +01:00
|
|
|
cfg_opt_getnposition(cfg_opt_t *opt, unsigned int oindex)
|
|
|
|
{
|
2008-04-11 11:19:23 +02:00
|
|
|
return * (position_t *) cfg_opt_getnptr(opt, oindex);
|
2008-03-19 11:58:43 +01:00
|
|
|
}
|
|
|
|
|
2008-04-11 11:19:23 +02:00
|
|
|
position_t
|
2008-03-19 11:58:43 +01:00
|
|
|
cfg_getnposition(cfg_t *cfg, const char *name, unsigned int oindex)
|
|
|
|
{
|
|
|
|
return cfg_opt_getnposition(cfg_getopt(cfg, name), oindex);
|
|
|
|
}
|
|
|
|
|
2008-04-11 11:19:23 +02:00
|
|
|
position_t
|
2008-03-19 11:58:43 +01:00
|
|
|
cfg_getposition(cfg_t *cfg, const char *name)
|
|
|
|
{
|
|
|
|
return cfg_getnposition(cfg, name, 0);
|
|
|
|
}
|
|
|
|
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines a style. */
|
2008-03-20 20:45:08 +01:00
|
|
|
cfg_opt_t style_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Windows border color. */
|
2008-03-20 20:45:08 +01:00
|
|
|
CFG_STR((char *) "border", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Background color. */
|
2008-03-20 20:45:08 +01:00
|
|
|
CFG_STR((char *) "bg", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Foreground color. */
|
2008-03-20 20:45:08 +01:00
|
|
|
CFG_STR((char *) "fg", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Shadow color. */
|
2008-03-20 20:45:08 +01:00
|
|
|
CFG_STR((char *) "shadow", NULL, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Shadow offset in pixels. */
|
2008-03-28 12:13:16 +01:00
|
|
|
CFG_INT((char *) "shadow_offset", 0xffffffff, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Font to use. */
|
2008-03-20 20:45:08 +01:00
|
|
|
CFG_STR((char *) "font", NULL, CFGF_NONE),
|
|
|
|
CFG_AWESOME_END()
|
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines several styles in a row. */
|
2008-03-20 20:45:08 +01:00
|
|
|
cfg_opt_t styles_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Normal style. */
|
2008-03-20 20:45:08 +01:00
|
|
|
CFG_SEC((char *) "normal", style_opts, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Style used for the focused window. */
|
2008-03-20 20:45:08 +01:00
|
|
|
CFG_SEC((char *) "focus", style_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Style used for windows with urgency hint. */
|
2008-03-20 20:45:08 +01:00
|
|
|
CFG_SEC((char *) "urgent", style_opts, CFGF_NONE),
|
|
|
|
CFG_AWESOME_END()
|
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines a titlebar. */
|
2008-03-14 20:35:24 +01:00
|
|
|
cfg_opt_t titlebar_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Titlebar position. */
|
2008-03-19 11:15:58 +01:00
|
|
|
CFG_POSITION((char *) "position", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Titlebar alignment around window. */
|
2008-03-24 17:42:45 +01:00
|
|
|
CFG_ALIGNMENT((char *) "align", (char *) "left", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Titlebar width. Set to 0 for auto. */
|
2008-03-24 16:31:02 +01:00
|
|
|
CFG_INT((char *) "width", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Titlebar height. Set to 0 for auto. */
|
2008-03-24 16:31:02 +01:00
|
|
|
CFG_INT((char *) "height", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Text alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "text_align", (char *) "center", CFGF_NONE),
|
2008-04-23 17:44:09 +02:00
|
|
|
/** Titlebar markup string for normal windows. */
|
2008-04-25 15:50:36 +02:00
|
|
|
CFG_STR((char *) "text_normal", (char *) "<bg color=\"#444444\"/>%t", CFGF_NONE),
|
|
|
|
/** Titlebar markup string for focused windows. */
|
|
|
|
CFG_STR((char *) "text_focus", (char *) "<bg color=\"#535d6c\"/>%t", CFGF_NONE),
|
2008-04-23 17:44:09 +02:00
|
|
|
/** Titlebar markup string for urgent windows. */
|
2008-04-25 15:50:36 +02:00
|
|
|
CFG_STR((char *) "text_urgent", (char *) "<bg color=\"#ff4500\"/>%t", CFGF_NONE),
|
2008-03-14 20:35:24 +01:00
|
|
|
CFG_AWESOME_END()
|
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines general options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t general_opts[] =
|
|
|
|
{
|
2008-04-10 23:37:22 +02:00
|
|
|
/** The border size of windows in pixels. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "border", 1, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** The number of pixels to snap when moving floating windows. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "snap", 8, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Use resize hints when resizing tiled windows. Can produce gaps between windows. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_BOOL((char *) "resize_hints", cfg_true, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Enable sloppy focus, also known as focus follows mouse. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_BOOL((char *) "sloppy_focus", cfg_true, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Raise the window if it is given focus with the mouse. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_BOOL((char *) "sloppy_focus_raise", cfg_false, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** New windows become master windows. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_BOOL((char *) "new_become_master", cfg_true, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** New windows get focus. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_BOOL((char *) "new_get_focus", cfg_true, CFGF_NONE),
|
2008-04-02 09:01:25 +02:00
|
|
|
/** Opacity of windows when unfocused. */
|
2008-03-23 20:38:16 +01:00
|
|
|
CFG_FLOAT((char *) "opacity_unfocused", -1, CFGF_NONE),
|
2008-04-02 09:01:25 +02:00
|
|
|
/** Opacity of windows when focused. */
|
2008-03-23 20:38:16 +01:00
|
|
|
CFG_FLOAT((char *) "opacity_focused", -1, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** How to dispose floating windows. Can be smart or under_mouse. */
|
2008-02-13 18:04:20 +01:00
|
|
|
CFG_STR((char *) "floating_placement", (char *) "smart", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Lower limit for the master window size factor. */
|
2008-03-08 10:48:15 +01:00
|
|
|
CFG_FLOAT((char *) "mwfact_lower_limit", 0.1, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Upper limit for the master window size factor. */
|
2008-03-08 10:48:15 +01:00
|
|
|
CFG_FLOAT((char *) "mwfact_upper_limit", 0.9, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines mouse bindings or the taglist widget. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t mouse_taglist_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Modifier keys. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse button. */
|
2008-03-21 16:50:17 +01:00
|
|
|
CFG_STR((char *) "button", (char *) "XCB_NONE", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Uicb command to run. */
|
2008-04-02 09:01:25 +02:00
|
|
|
CFG_STR((char *) "command", NULL, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines generic mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t mouse_generic_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Modifier keys. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR_LIST((char *) "modkey", (char *) "{}", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse button. */
|
2008-03-21 16:50:17 +01:00
|
|
|
CFG_STR((char *) "button", (char *) "XCB_NONE", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Uicb command to run. */
|
2008-04-02 09:01:25 +02:00
|
|
|
CFG_STR((char *) "command", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Argument to use for command. */
|
2008-03-28 02:12:55 +01:00
|
|
|
CFG_STR((char *) "arg", NULL, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines common widgets options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t widget_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** X coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Y coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "align", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines taglist widget options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t widget_taglist_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** X coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Y coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "align", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "mouse", mouse_taglist_opts, CFGF_MULTI),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines iconbox widget options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t widget_iconbox_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** X coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Y coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "align", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Image to draw. */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "image", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Enable automatic resize of the image. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_BOOL((char *) "resize", cfg_true, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines textbox widget options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t widget_textbox_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** X coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Y coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "align", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget width. Set to 0 for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "width", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Default printed text. */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "text", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Text alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "text_align", (char *) "center", CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-31 10:15:38 +02:00
|
|
|
/** This section defines emptybox widget options. */
|
|
|
|
cfg_opt_t widget_emptybox_opts[] =
|
|
|
|
{
|
|
|
|
/** X coordinate, do not set for auto. */
|
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
|
|
|
/** Y coordinate, do not set for auto. */
|
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
2008-04-01 08:20:59 +02:00
|
|
|
/** Widget alignment. */
|
|
|
|
CFG_ALIGNMENT((char *) "align", (char *) "auto", CFGF_NONE),
|
2008-03-31 10:15:38 +02:00
|
|
|
/** Mouse bindings. */
|
|
|
|
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
|
|
|
/** Widget width. Set to 0 for auto. */
|
|
|
|
CFG_INT((char *) "width", 0, CFGF_NONE),
|
|
|
|
/** Style to use for drawing. */
|
|
|
|
CFG_SEC((char *) "style", style_opts, CFGF_NONE),
|
|
|
|
CFG_AWESOME_END()
|
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines tasklist widget options */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t widget_tasklist_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** X coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Y coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Styles to use for drawing. */
|
2008-03-14 08:35:06 +01:00
|
|
|
CFG_SEC((char *) "styles", styles_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Text alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "text_align", (char *) "left", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Which windows to show: tags, all or focus. */
|
2008-02-06 20:03:18 +01:00
|
|
|
CFG_STR((char *) "show", (char *) "tags", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Show icons of windows. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_BOOL((char *) "show_icons", cfg_true, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines graph data widget options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t widget_graph_data_opts[] =
|
|
|
|
{
|
2008-03-28 02:12:55 +01:00
|
|
|
/** Value of a full graph. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_FLOAT((char *) "max", 100.0f, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Scale graph when values are bigger than 'max'. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_BOOL((char *) "scale", cfg_false, CFGF_NONE),
|
2008-03-28 02:12:55 +01:00
|
|
|
/** Foreground color. */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "fg", NULL, CFGF_NONE),
|
2008-03-28 02:12:55 +01:00
|
|
|
/** Foreground color in the center of the bar (as gradient). */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "fg_center", NULL, CFGF_NONE),
|
2008-03-28 02:12:55 +01:00
|
|
|
/** Foreground color at the end of a bar (as gradient). */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "fg_end", NULL, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** fg, fg_center and fg_end define a vertical gradient. */
|
2008-03-09 23:49:03 +01:00
|
|
|
CFG_BOOL((char *) "vertical_gradient", cfg_false, CFGF_NONE),
|
2008-03-28 02:12:55 +01:00
|
|
|
/** Draw style. */
|
2008-03-15 17:44:14 +01:00
|
|
|
CFG_STR((char *) "draw_style", (char *) "bottom", CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines graph widget options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t widget_graph_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** X coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Y coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "align", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Data stream. */
|
2008-02-17 07:56:52 +01:00
|
|
|
CFG_SEC((char *) "data", widget_graph_data_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget width. Set to 0 for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "width", 100, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Put new values onto the 'left' or 'right'. */
|
2008-03-19 11:15:58 +01:00
|
|
|
CFG_POSITION((char *) "grow", (char *) "left", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Set height (i.e. 0.9 = 90%). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_FLOAT((char *) "height", 0.67, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Background color. */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "bg", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Border color. */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "bordercolor", NULL, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines graph widget options. */
|
2008-02-17 07:56:52 +01:00
|
|
|
cfg_opt_t widget_progressbar_data_opts[] =
|
2008-01-31 16:34:00 +01:00
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Foreground color. */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "fg", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Foreground color in the center of the bar (as gradient). */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "fg_center", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Foreground color at the end of a bar (as gradient). */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "fg_end", NULL, CFGF_NONE),
|
2008-03-28 02:12:55 +01:00
|
|
|
/** Foreground color of not filled bar/ticks. */
|
2008-03-26 03:18:21 +01:00
|
|
|
CFG_STR((char *) "fg_off", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Background color. */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "bg", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Border color. */
|
2008-03-19 13:32:16 +01:00
|
|
|
CFG_STR((char *) "bordercolor", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Reverse/mirror the bar. */
|
2008-03-02 13:13:12 +01:00
|
|
|
CFG_BOOL((char *) "reverse", cfg_false, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines progressbar widget options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t widget_progressbar_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** X coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Y coordinate, do not set for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget alignment. */
|
2008-03-19 11:45:27 +01:00
|
|
|
CFG_ALIGNMENT((char *) "align", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Draws a bar for each data section. */
|
2008-02-17 07:56:52 +01:00
|
|
|
CFG_SEC((char *) "data", widget_progressbar_data_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Widget width. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "width", 100, CFGF_NONE),
|
2008-03-28 02:12:55 +01:00
|
|
|
/** Distance between individual bars. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "gap", 2, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Border width in pixels. */
|
2008-03-26 03:18:21 +01:00
|
|
|
CFG_INT((char *) "border_width", 1, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Padding between border and ticks/bar. */
|
2008-03-26 03:18:21 +01:00
|
|
|
CFG_INT((char *) "border_padding", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Distance between the ticks. */
|
2008-03-26 03:18:21 +01:00
|
|
|
CFG_INT((char *) "ticks_gap", 1, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Number of 'ticks' to draw. */
|
2008-03-26 03:18:21 +01:00
|
|
|
CFG_INT((char *) "ticks_count", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Set height (i.e. 0.9 = 90%). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_FLOAT((char *) "height", 0.67, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Draw the bar(s) vertically. */
|
2008-03-02 21:53:18 +01:00
|
|
|
CFG_BOOL((char *) "vertical", cfg_false, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines statusbar options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t statusbar_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Statusbar position. */
|
2008-03-19 11:15:58 +01:00
|
|
|
CFG_POSITION((char *) "position", (char *) "top", CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Statusbar height. Set to 0 for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "height", 0, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Statusbar width. Set to 0 for auto. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "width", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Textbox widget(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "textbox", widget_textbox_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-31 10:15:38 +02:00
|
|
|
/** Emptybox widget(s). */
|
|
|
|
CFG_SEC((char *) "emptybox", widget_emptybox_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Taglist widget(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "taglist", widget_taglist_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Layoutinfo widget(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "layoutinfo", widget_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Iconbox widget(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "iconbox", widget_iconbox_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Focusicon widget(s). */
|
2008-02-06 20:13:41 +01:00
|
|
|
CFG_SEC((char *) "focusicon", widget_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Progressbar widget(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "progressbar", widget_progressbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Graph(s) widget(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "graph", widget_graph_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Tasklist(s) widget(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "tasklist", widget_tasklist_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines tag options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t tag_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Default layout for this tag. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "layout", (char *) "tile", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Default master width factor for this tag. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_FLOAT((char *) "mwfact", 0.5, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Default number of master windows for this tag. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "nmaster", 1, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Default number of window columns for this tag. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "ncol", 1, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-04-10 23:37:22 +02:00
|
|
|
/** This section defines tags options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t tags_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Available tag(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "tag", tag_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines layout options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t layout_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Image to represent layout in layoutinfo widget. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "image", NULL, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines layouts options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t layouts_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Available layout(s). */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "layout", layout_opts, CFGF_TITLE | CFGF_MULTI),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines padding options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t padding_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Top padding in pixels. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "top", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Bottom padding in pixels. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "bottom", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Right padding in pixels. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "right", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Left padding in pixels. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "left", 0, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines screen options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t screen_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** General options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "general", general_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Titlebar definitions. */
|
2008-03-14 20:35:24 +01:00
|
|
|
CFG_SEC((char *) "titlebar", titlebar_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Statubar(s) definitions. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "statusbar", statusbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Tags definitions. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "tags", tags_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Styles definitions. */
|
2008-03-14 08:35:06 +01:00
|
|
|
CFG_SEC((char *) "styles", styles_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Layouts definitions. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "layouts", layouts_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Paddings definitions. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "padding", padding_opts, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines rule options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t rule_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Name of the xproperty to match. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "xproperty_name", NULL, CFGF_NONE),
|
2008-04-30 11:11:32 +02:00
|
|
|
/** Regexp value of the xproperty above to match. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "xproperty_value", NULL, CFGF_NONE),
|
2008-04-30 11:11:32 +02:00
|
|
|
/** Regexp to match the window against a string formatted like: class:name:title. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "name", NULL, CFGF_NONE),
|
2008-04-30 11:11:32 +02:00
|
|
|
/** Tags matching that regexp to tag windows with. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "tags", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Icon to use for that window. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "icon", NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Set this window floating. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "float", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Set this window as master. */
|
2008-02-05 17:31:37 +01:00
|
|
|
CFG_STR((char *) "master", (char *) "auto", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Titlebar for this window. */
|
2008-03-14 20:35:24 +01:00
|
|
|
CFG_SEC((char *) "titlebar", titlebar_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Screen to start this window on. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Opacity for this window. */
|
2008-03-24 07:47:07 +01:00
|
|
|
CFG_FLOAT((char *) "opacity", -1, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines rules options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t rules_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** A rule. A window can match one rule. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "rule", rule_opts, CFGF_MULTI),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines a global key binding. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t key_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Modifier keys. */
|
2008-02-02 09:33:05 +01:00
|
|
|
CFG_STR_LIST((char *) "modkey", (char *) "", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Key to press. */
|
2008-03-21 16:50:17 +01:00
|
|
|
CFG_STR((char *) "key", (char *) "XCB_NONE", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Uicb command to run. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Argument to use for command. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "arg", NULL, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines keylist options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t keylist_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Modifier keys. */
|
2008-02-02 09:33:05 +01:00
|
|
|
CFG_STR_LIST((char *) "modkey", (char *) "", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** List of keys, order matters. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR_LIST((char *) "keylist", (char *) NULL, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Uicb command to run. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR((char *) "command", (char *) "", CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** List of arguments for command, order matters. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_STR_LIST((char *) "arglist", NULL, CFGF_NONE),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines keys options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t keys_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** A key binding. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "key", key_opts, CFGF_MULTI),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** A list of key bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "keylist", keylist_opts, CFGF_MULTI),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines mouse options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t mouse_opts[] =
|
|
|
|
{
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings for the root window. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "root", mouse_generic_opts, CFGF_MULTI),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Mouse bindings for the clients' window. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "client", mouse_generic_opts, CFGF_MULTI),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Mouse bindings for the clients' titlebar. */
|
2008-03-19 15:34:07 +01:00
|
|
|
CFG_SEC((char *) "titlebar", mouse_generic_opts, CFGF_MULTI),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines menu options. */
|
2008-03-09 16:00:14 +01:00
|
|
|
cfg_opt_t menu_opts[] =
|
|
|
|
{
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Width of the menu. Set to 0 for auto. */
|
2008-03-09 16:00:14 +01:00
|
|
|
CFG_INT((char *) "width", 0, CFGF_NONE),
|
2008-04-10 23:37:22 +02:00
|
|
|
/** Height of the menu. Set to 0 for auto. */
|
2008-03-09 16:00:14 +01:00
|
|
|
CFG_INT((char *) "height", 0, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** X coordinate, do not set for auto. */
|
2008-03-09 16:00:14 +01:00
|
|
|
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Y coordinate, do not set for auto. */
|
|
|
|
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
|
|
|
/** Styles to use for this menu. */
|
2008-03-14 08:35:06 +01:00
|
|
|
CFG_SEC((char *) "styles", styles_opts, CFGF_NONE),
|
2008-03-09 16:00:14 +01:00
|
|
|
CFG_AWESOME_END()
|
|
|
|
};
|
2008-03-27 18:31:55 +01:00
|
|
|
/** This section defines global awesome options. */
|
2008-01-31 16:34:00 +01:00
|
|
|
cfg_opt_t awesome_opts[] =
|
|
|
|
{
|
2008-04-10 23:37:22 +02:00
|
|
|
/** The screens section. Make one for each of your screens. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "screen", screen_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** The rules section. This allows specific options for specific windows. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "rules", rules_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Key bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "keys", keys_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Mouse bindings. */
|
2008-01-31 16:34:00 +01:00
|
|
|
CFG_SEC((char *) "mouse", mouse_opts, CFGF_NONE),
|
2008-03-27 18:31:55 +01:00
|
|
|
/** Menu options. */
|
2008-03-09 16:00:14 +01:00
|
|
|
CFG_SEC((char *) "menu", menu_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
2008-02-29 09:54:03 +01:00
|
|
|
CFG_AWESOME_END()
|
2008-01-31 16:34:00 +01:00
|
|
|
};
|
|
|
|
|
2008-02-27 09:32:45 +01:00
|
|
|
/** Return default configuration file path
|
|
|
|
* \return path to the default configuration file
|
|
|
|
*/
|
2008-01-31 16:34:00 +01:00
|
|
|
char *
|
|
|
|
config_file(void)
|
|
|
|
{
|
|
|
|
const char *homedir;
|
|
|
|
char * confpath;
|
|
|
|
ssize_t confpath_len;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
return confpath;
|
|
|
|
}
|
|
|
|
|
2008-03-18 13:00:10 +01:00
|
|
|
static int
|
|
|
|
config_validate_unsigned_int(cfg_t *cfg, cfg_opt_t *opt)
|
|
|
|
{
|
|
|
|
int value = cfg_opt_getnint(opt, cfg_opt_size(opt) - 1);
|
|
|
|
|
|
|
|
if(value < 0)
|
|
|
|
{
|
|
|
|
cfg_error(cfg, "integer option '%s' must be positive in section '%s'",
|
|
|
|
opt->name, cfg->name);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-18 13:08:11 +01:00
|
|
|
static int
|
|
|
|
config_validate_supone_int(cfg_t *cfg, cfg_opt_t *opt)
|
|
|
|
{
|
|
|
|
int value = cfg_opt_getnint(opt, cfg_opt_size(opt) - 1);
|
|
|
|
|
|
|
|
if(value < 1)
|
|
|
|
{
|
|
|
|
cfg_error(cfg, "integer option '%s' must be at least 1 in section '%s'",
|
|
|
|
opt->name, cfg->name);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
config_validate_zero_one_float(cfg_t *cfg, cfg_opt_t *opt)
|
|
|
|
{
|
|
|
|
float value = cfg_opt_getnfloat(opt, cfg_opt_size(opt) - 1);
|
|
|
|
|
|
|
|
if(value < 0.0 || value > 1.0)
|
|
|
|
{
|
2008-03-19 10:01:12 +01:00
|
|
|
cfg_error(cfg, "float option '%s' must be at least 0.0 and less than 1.0 in section '%s'",
|
|
|
|
opt->name, cfg->name);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-02 09:01:25 +02:00
|
|
|
static int
|
|
|
|
config_validate_supzero_float(cfg_t *cfg, cfg_opt_t *opt)
|
|
|
|
{
|
|
|
|
float value = cfg_opt_getnfloat(opt, cfg_opt_size(opt) - 1);
|
|
|
|
|
|
|
|
if(value <= 0.0)
|
|
|
|
{
|
|
|
|
cfg_error(cfg, "float option '%s' must be greater than 0.0 section '%s'",
|
|
|
|
opt->name, cfg->name);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-18 13:00:10 +01:00
|
|
|
cfg_t *
|
|
|
|
cfg_new(void)
|
|
|
|
{
|
|
|
|
cfg_t *cfg;
|
|
|
|
|
|
|
|
cfg = cfg_init(awesome_opts, CFGF_NONE);
|
|
|
|
|
2008-03-18 13:08:11 +01:00
|
|
|
/* Check integers values */
|
2008-03-18 13:00:10 +01:00
|
|
|
cfg_set_validate_func(cfg, "screen|general|snap", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|general|border", config_validate_unsigned_int);
|
2008-03-18 13:08:11 +01:00
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|height", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|tags|tag|nmaster", config_validate_unsigned_int);
|
2008-03-24 16:31:02 +01:00
|
|
|
cfg_set_validate_func(cfg, "screen|titlebar|width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|titlebar|height", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "rules|rule|titlebar|width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "rules|rule|titlebar|height", config_validate_unsigned_int);
|
2008-04-02 09:01:25 +02:00
|
|
|
cfg_set_validate_func(cfg, "rules|rule|screen", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|textbox|width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|emptybox|width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|graph|width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|progressbar|width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|progressbar|border_width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|progressbar|border_padding", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|progressbar|ticks_gap", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|progressbar|ticks_count", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "menu|width", config_validate_unsigned_int);
|
|
|
|
cfg_set_validate_func(cfg, "menu|height", config_validate_unsigned_int);
|
2008-03-19 13:32:16 +01:00
|
|
|
|
|
|
|
/* Check integers values > 1 */
|
2008-03-18 13:08:11 +01:00
|
|
|
cfg_set_validate_func(cfg, "screen|tags|tag|ncol", config_validate_supone_int);
|
|
|
|
|
|
|
|
/* Check float values */
|
2008-03-19 06:53:41 +01:00
|
|
|
cfg_set_validate_func(cfg, "screen|general|mwfact_lower_limit", config_validate_zero_one_float);
|
|
|
|
cfg_set_validate_func(cfg, "screen|general|mwfact_upper_limit", config_validate_zero_one_float);
|
2008-03-18 13:08:11 +01:00
|
|
|
cfg_set_validate_func(cfg, "screen|tags|tag|mwfact", config_validate_zero_one_float);
|
2008-03-24 07:47:07 +01:00
|
|
|
cfg_set_validate_func(cfg, "screen|general|opacity_unfocused", config_validate_zero_one_float);
|
|
|
|
cfg_set_validate_func(cfg, "screen|general|opacity_focused", config_validate_zero_one_float);
|
|
|
|
cfg_set_validate_func(cfg, "rules|rule|opacity", config_validate_zero_one_float);
|
2008-04-02 09:01:25 +02:00
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|graph|height", config_validate_zero_one_float);
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|progressbar|height", config_validate_zero_one_float);
|
|
|
|
|
|
|
|
/* Check float values > 0.0 */
|
|
|
|
cfg_set_validate_func(cfg, "screen|statusbar|graph|data|max", config_validate_supzero_float);
|
2008-03-18 13:00:10 +01:00
|
|
|
|
|
|
|
return cfg;
|
|
|
|
}
|
|
|
|
|
2008-02-27 09:32:45 +01:00
|
|
|
/** Check configuration file syntax in regard of libconfuse parsing
|
|
|
|
* \param path to config file
|
|
|
|
* \return status returned by cfg_parse()
|
|
|
|
*/
|
2008-01-31 16:34:00 +01:00
|
|
|
int
|
|
|
|
config_check(const char *confpatharg)
|
|
|
|
{
|
|
|
|
cfg_t *cfg;
|
|
|
|
int ret;
|
|
|
|
char *confpath;
|
|
|
|
|
2008-03-18 13:00:10 +01:00
|
|
|
cfg = cfg_new();
|
2008-01-31 16:34:00 +01:00
|
|
|
|
|
|
|
if(confpatharg)
|
|
|
|
confpath = a_strdup(confpatharg);
|
|
|
|
else
|
|
|
|
confpath = config_file();
|
|
|
|
|
|
|
|
switch((ret = cfg_parse(cfg, confpath)))
|
|
|
|
{
|
|
|
|
case CFG_FILE_ERROR:
|
2008-03-19 13:11:13 +01:00
|
|
|
warn("parsing configuration file failed: %s\n", strerror(errno));
|
2008-01-31 16:34:00 +01:00
|
|
|
break;
|
|
|
|
case CFG_PARSE_ERROR:
|
|
|
|
cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath);
|
|
|
|
break;
|
|
|
|
case CFG_SUCCESS:
|
|
|
|
printf("Configuration file OK.\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
p_delete(&confpath);
|
2008-03-18 13:00:10 +01:00
|
|
|
cfg_free(cfg);
|
2008-01-31 16:34:00 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|