2007-10-03 17:26:14 +02:00
|
|
|
/*
|
2007-09-12 14:29:51 +02:00
|
|
|
* config.c - configuration management
|
2007-10-03 17:26:14 +02:00
|
|
|
*
|
2008-01-02 16:59:43 +01:00
|
|
|
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
|
2007-10-03 17:26:14 +02:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2007-09-12 14:29:51 +02:00
|
|
|
*/
|
|
|
|
|
2008-03-19 13:11:13 +01:00
|
|
|
#include <errno.h>
|
2007-09-05 20:15:00 +02:00
|
|
|
#include <X11/keysym.h>
|
|
|
|
|
2008-01-29 11:27:14 +01:00
|
|
|
#include "config.h"
|
2007-11-15 14:41:03 +01:00
|
|
|
#include "statusbar.h"
|
2008-01-13 15:44:01 +01:00
|
|
|
#include "tag.h"
|
2007-11-15 14:41:03 +01:00
|
|
|
#include "rules.h"
|
|
|
|
#include "screen.h"
|
2007-12-15 18:21:02 +01:00
|
|
|
#include "widget.h"
|
2007-12-13 11:16:43 +01:00
|
|
|
#include "defconfig.h"
|
2007-12-27 23:28:33 +01:00
|
|
|
#include "layouts/tile.h"
|
2008-01-30 14:07:14 +01:00
|
|
|
#include "common/configopts.h"
|
2008-03-04 20:39:21 +01:00
|
|
|
#include "common/xutil.h"
|
2007-10-12 13:09:59 +02:00
|
|
|
|
2008-01-16 20:53:46 +01:00
|
|
|
/* Permit to use mouse with many more buttons */
|
|
|
|
#ifndef Button6
|
|
|
|
#define Button6 6
|
|
|
|
#endif
|
|
|
|
#ifndef Button7
|
|
|
|
#define Button7 7
|
|
|
|
#endif
|
2008-05-28 07:30:30 +02:00
|
|
|
#ifndef Button8
|
|
|
|
#define Button8 8
|
|
|
|
#endif
|
|
|
|
#ifndef Button9
|
|
|
|
#define Button9 9
|
|
|
|
#endif
|
2008-01-16 20:53:46 +01:00
|
|
|
|
2007-12-19 04:46:44 +01:00
|
|
|
extern AwesomeConf globalconf;
|
2008-01-31 16:34:00 +01:00
|
|
|
extern cfg_opt_t awesome_opts[];
|
2007-12-16 02:45:38 +01:00
|
|
|
|
2007-09-05 20:15:00 +02:00
|
|
|
/** Link a name to a key symbol */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char *name;
|
2008-04-18 14:57:52 +02:00
|
|
|
KeySym keysym;
|
2007-09-05 20:15:00 +02:00
|
|
|
} KeyMod;
|
|
|
|
|
2007-11-11 15:40:01 +01:00
|
|
|
/** Link a name to a mouse button symbol */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
unsigned int button;
|
|
|
|
} MouseButton;
|
|
|
|
|
2008-01-12 14:34:53 +01:00
|
|
|
extern const name_func_link_t UicbList[];
|
|
|
|
extern const name_func_link_t WidgetList[];
|
2008-01-12 21:36:24 +01:00
|
|
|
extern const name_func_link_t LayoutList[];
|
2008-02-13 18:04:20 +01:00
|
|
|
extern const name_func_link_t FloatingPlacementList[];
|
2007-12-19 03:20:21 +01:00
|
|
|
|
2007-09-05 20:15:00 +02:00
|
|
|
/** Lookup for a key mask from its name
|
|
|
|
* \param keyname Key name
|
|
|
|
* \return Key mask or 0 if not found
|
|
|
|
*/
|
2008-04-18 14:57:52 +02:00
|
|
|
static KeySym
|
2007-09-05 20:15:00 +02:00
|
|
|
key_mask_lookup(const char *keyname)
|
|
|
|
{
|
2007-12-16 13:22:13 +01:00
|
|
|
/** List of keyname and corresponding X11 mask codes */
|
|
|
|
static const KeyMod KeyModList[] =
|
|
|
|
{
|
|
|
|
{"Shift", ShiftMask},
|
|
|
|
{"Lock", LockMask},
|
|
|
|
{"Control", ControlMask},
|
|
|
|
{"Mod1", Mod1Mask},
|
|
|
|
{"Mod2", Mod2Mask},
|
|
|
|
{"Mod3", Mod3Mask},
|
|
|
|
{"Mod4", Mod4Mask},
|
|
|
|
{"Mod5", Mod5Mask},
|
|
|
|
{NULL, NoSymbol}
|
|
|
|
};
|
2007-09-05 20:15:00 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if(keyname)
|
|
|
|
for(i = 0; KeyModList[i].name; i++)
|
2007-09-21 17:32:00 +02:00
|
|
|
if(!a_strcmp(keyname, KeyModList[i].name))
|
2008-04-18 14:57:52 +02:00
|
|
|
return KeyModList[i].keysym;
|
2007-09-05 20:15:00 +02:00
|
|
|
|
2008-02-08 14:35:32 +01:00
|
|
|
return 0;
|
2007-09-06 23:29:50 +02:00
|
|
|
}
|
2007-09-05 20:15:00 +02:00
|
|
|
|
2007-11-11 15:40:01 +01:00
|
|
|
/** Lookup for a mouse button from its name
|
|
|
|
* \param button Mouse button name
|
|
|
|
* \return Mouse button or 0 if not found
|
|
|
|
*/
|
|
|
|
static unsigned int
|
|
|
|
mouse_button_lookup(const char *button)
|
|
|
|
{
|
2007-12-16 13:22:13 +01:00
|
|
|
/** List of button name and corresponding X11 mask codes */
|
|
|
|
static const MouseButton MouseButtonList[] =
|
|
|
|
{
|
|
|
|
{"1", Button1},
|
|
|
|
{"2", Button2},
|
|
|
|
{"3", Button3},
|
|
|
|
{"4", Button4},
|
|
|
|
{"5", Button5},
|
2008-01-16 20:53:46 +01:00
|
|
|
{"6", Button6},
|
|
|
|
{"7", Button7},
|
2008-05-28 07:30:30 +02:00
|
|
|
{"8", Button8},
|
|
|
|
{"9", Button9},
|
2007-12-16 13:22:13 +01:00
|
|
|
{NULL, 0}
|
|
|
|
};
|
2007-11-11 15:40:01 +01:00
|
|
|
int i;
|
2008-02-13 06:53:08 +01:00
|
|
|
|
2007-11-11 15:40:01 +01:00
|
|
|
if(button)
|
|
|
|
for(i = 0; MouseButtonList[i].name; i++)
|
|
|
|
if(!a_strcmp(button, MouseButtonList[i].name))
|
|
|
|
return MouseButtonList[i].button;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-12 13:21:28 +01:00
|
|
|
static Button *
|
|
|
|
parse_mouse_bindings(cfg_t * cfg, const char *secname, Bool handle_arg)
|
2007-11-12 11:59:57 +01:00
|
|
|
{
|
2008-01-12 20:56:41 +01:00
|
|
|
int i, j;
|
2007-11-12 11:59:57 +01:00
|
|
|
cfg_t *cfgsectmp;
|
2007-11-12 13:21:28 +01:00
|
|
|
Button *b = NULL, *head = NULL;
|
2007-11-12 11:59:57 +01:00
|
|
|
|
|
|
|
/* Mouse: layout click bindings */
|
2008-01-12 20:56:41 +01:00
|
|
|
for(i = cfg_size(cfg, secname) - 1; i >= 0; i--)
|
2007-11-12 11:59:57 +01:00
|
|
|
{
|
2008-01-12 20:56:41 +01:00
|
|
|
b = p_new(Button, 1);
|
2007-11-12 13:21:28 +01:00
|
|
|
|
2007-11-12 11:59:57 +01:00
|
|
|
cfgsectmp = cfg_getnsec(cfg, secname, i);
|
2008-01-12 20:56:41 +01:00
|
|
|
for(j = cfg_size(cfgsectmp, "modkey") - 1; j >= 0; j--)
|
2007-11-12 13:21:28 +01:00
|
|
|
b->mod |= key_mask_lookup(cfg_getnstr(cfgsectmp, "modkey", j));
|
|
|
|
b->button = mouse_button_lookup(cfg_getstr(cfgsectmp, "button"));
|
|
|
|
b->func = name_func_lookup(cfg_getstr(cfgsectmp, "command"), UicbList);
|
2007-11-14 18:28:28 +01:00
|
|
|
if(!b->func)
|
2007-12-13 02:40:45 +01:00
|
|
|
warn("unknown command %s\n", cfg_getstr(cfgsectmp, "command"));
|
2007-11-12 12:07:18 +01:00
|
|
|
if(handle_arg)
|
2007-11-12 13:21:28 +01:00
|
|
|
b->arg = a_strdup(cfg_getstr(cfgsectmp, "arg"));
|
2007-11-12 12:07:18 +01:00
|
|
|
else
|
2007-11-12 13:21:28 +01:00
|
|
|
b->arg = NULL;
|
|
|
|
|
2008-01-12 20:56:41 +01:00
|
|
|
button_list_push(&head, b);
|
2007-11-12 11:59:57 +01:00
|
|
|
}
|
2007-11-12 13:21:28 +01:00
|
|
|
|
|
|
|
return head;
|
2007-11-12 11:59:57 +01:00
|
|
|
}
|
|
|
|
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
|
2008-01-03 17:09:27 +01:00
|
|
|
static void
|
|
|
|
set_key_info(Key *key, cfg_t *cfg)
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
{
|
|
|
|
unsigned int j;
|
|
|
|
|
|
|
|
for(j = 0; j < cfg_size(cfg, "modkey"); j++)
|
|
|
|
key->mod |= key_mask_lookup(cfg_getnstr(cfg, "modkey", j));
|
|
|
|
key->func = name_func_lookup(cfg_getstr(cfg, "command"), UicbList);
|
|
|
|
if(!key->func)
|
2007-12-13 14:03:55 +01:00
|
|
|
warn("unknown command %s\n", cfg_getstr(cfg, "command"));
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
}
|
|
|
|
|
2008-05-02 11:12:53 +02:00
|
|
|
static void
|
|
|
|
config_key_store(Key *key, char *str)
|
2008-01-20 17:55:09 +01:00
|
|
|
{
|
|
|
|
KeyCode kc;
|
|
|
|
int ikc;
|
|
|
|
|
2008-05-02 11:12:53 +02:00
|
|
|
if(!a_strlen(str))
|
|
|
|
return;
|
|
|
|
else if(a_strncmp(str, "#", 1))
|
|
|
|
key->keysym = XStringToKeysym(str);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ikc = atoi(str + 1);
|
|
|
|
memcpy(&kc, &ikc, sizeof(KeyCode));
|
|
|
|
key->keycode = kc;
|
|
|
|
}
|
2008-01-20 17:55:09 +01:00
|
|
|
}
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
|
2008-01-03 17:09:27 +01:00
|
|
|
static Key *
|
|
|
|
section_keys(cfg_t *cfg_keys)
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
{
|
2008-01-12 20:53:19 +01:00
|
|
|
Key *key = NULL, *head = NULL;
|
|
|
|
int i, j, numkeys;
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
cfg_t *cfgkeytmp;
|
|
|
|
|
2008-01-12 20:53:19 +01:00
|
|
|
for(i = cfg_size(cfg_keys, "key") - 1; i >= 0; i--)
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
{
|
2008-01-12 20:53:19 +01:00
|
|
|
key = p_new(Key, 1);
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
cfgkeytmp = cfg_getnsec(cfg_keys, "key", i);
|
|
|
|
set_key_info(key, cfgkeytmp);
|
2008-05-02 11:12:53 +02:00
|
|
|
config_key_store(key, cfg_getstr(cfgkeytmp, "key"));
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
key->arg = a_strdup(cfg_getstr(cfgkeytmp, "arg"));
|
2008-01-12 20:53:19 +01:00
|
|
|
key_list_push(&head, key);
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
}
|
|
|
|
|
2008-01-12 20:53:19 +01:00
|
|
|
for(i = cfg_size(cfg_keys, "keylist") - 1; i >= 0; i--)
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
{
|
|
|
|
cfgkeytmp = cfg_getnsec(cfg_keys, "keylist", i);
|
|
|
|
numkeys = cfg_size(cfgkeytmp, "keylist");
|
2008-01-12 20:53:19 +01:00
|
|
|
if(numkeys != (int) cfg_size(cfgkeytmp, "arglist"))
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
{
|
2007-12-13 14:03:55 +01:00
|
|
|
warn("number of keys != number of args in keylist");
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
continue;
|
|
|
|
}
|
2008-01-12 20:53:19 +01:00
|
|
|
|
|
|
|
for(j = 0; j < numkeys; j++)
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
{
|
2008-01-12 20:53:19 +01:00
|
|
|
key = p_new(Key, 1);
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
set_key_info(key, cfgkeytmp);
|
2008-05-02 11:12:53 +02:00
|
|
|
config_key_store(key, cfg_getnstr(cfgkeytmp, "keylist", j));
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
key->arg = a_strdup(cfg_getnstr(cfgkeytmp, "arglist", j));
|
2008-01-12 20:53:19 +01:00
|
|
|
key_list_push(&head, key);
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
}
|
|
|
|
}
|
2008-01-12 20:53:19 +01:00
|
|
|
|
Add a way to define key bindings in bulk, like this:
keylist
{
modkey = {"Mod4"}
command = "client_tag"
keylist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arglist = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
}
This patch also modifies the example awesomerc to use the new syntax. Should
be fully backwards compatible.
2007-12-12 01:24:27 +01:00
|
|
|
return head;
|
|
|
|
}
|
|
|
|
|
2007-12-16 08:41:10 +01:00
|
|
|
|
|
|
|
static int
|
2007-12-16 13:22:13 +01:00
|
|
|
cmp_widget_cfg(const void *a, const void *b)
|
|
|
|
{
|
2007-12-16 08:41:10 +01:00
|
|
|
if (((cfg_t*)a)->line < ((cfg_t*)b)->line)
|
|
|
|
return -1;
|
2007-12-16 13:22:13 +01:00
|
|
|
|
|
|
|
if (((cfg_t*)a)->line > ((cfg_t*)b)->line)
|
2007-12-16 08:41:10 +01:00
|
|
|
return 1;
|
2007-12-16 13:22:13 +01:00
|
|
|
|
|
|
|
return 0;
|
2007-12-16 08:41:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-03-20 08:42:13 +01:00
|
|
|
statusbar_widgets_create(cfg_t *cfg_statusbar, Statusbar *statusbar)
|
2007-12-16 08:41:10 +01:00
|
|
|
{
|
|
|
|
cfg_t* widgets, *wptr;
|
|
|
|
Widget *widget = NULL;
|
2007-12-17 08:08:06 +01:00
|
|
|
unsigned int i, j, numwidgets = 0;
|
2007-12-16 09:34:33 +01:00
|
|
|
WidgetConstructor *widget_new;
|
2007-12-16 08:41:10 +01:00
|
|
|
|
2007-12-17 08:08:06 +01:00
|
|
|
for(i = 0; WidgetList[i].name; i++)
|
|
|
|
numwidgets += cfg_size(cfg_statusbar, WidgetList[i].name);
|
|
|
|
|
2008-04-28 21:58:19 +02:00
|
|
|
wptr = widgets = p_new(cfg_t, numwidgets);
|
2007-12-16 08:41:10 +01:00
|
|
|
|
2007-12-17 08:08:06 +01:00
|
|
|
for(i = 0; WidgetList[i].name; i++)
|
|
|
|
for (j = 0; j < cfg_size(cfg_statusbar, WidgetList[i].name); j++)
|
2007-12-16 08:41:10 +01:00
|
|
|
{
|
|
|
|
memcpy(wptr,
|
2007-12-17 08:08:06 +01:00
|
|
|
cfg_getnsec(cfg_statusbar, WidgetList[i].name, j),
|
2007-12-16 08:41:10 +01:00
|
|
|
sizeof(cfg_t));
|
|
|
|
wptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
qsort(widgets, numwidgets, sizeof(cfg_t), cmp_widget_cfg);
|
|
|
|
|
2008-01-12 21:35:44 +01:00
|
|
|
for(i = 0; i < numwidgets; i++)
|
2007-12-22 16:25:22 +01:00
|
|
|
{
|
2008-04-28 21:58:19 +02:00
|
|
|
wptr = &widgets[i];
|
2007-12-17 10:57:17 +01:00
|
|
|
widget_new = name_func_lookup(cfg_name(wptr), WidgetList);
|
2007-12-27 15:49:00 +01:00
|
|
|
if(widget_new)
|
|
|
|
{
|
2008-01-12 21:35:44 +01:00
|
|
|
widget = widget_new(statusbar, wptr);
|
|
|
|
widget_list_append(&statusbar->widgets, widget);
|
2008-03-20 20:45:08 +01:00
|
|
|
widget->buttons = parse_mouse_bindings(wptr, "mouse",
|
|
|
|
a_strcmp(cfg_name(wptr), "taglist") ? True : False);
|
2007-12-27 15:49:00 +01:00
|
|
|
}
|
2007-12-16 08:41:10 +01:00
|
|
|
else
|
2008-03-19 09:55:15 +01:00
|
|
|
warn("ignoring unknown widget: %s.\n", cfg_name(widgets + i));
|
2007-12-16 08:41:10 +01:00
|
|
|
}
|
2008-04-28 21:58:19 +02:00
|
|
|
p_delete(&widgets);
|
2007-12-16 08:41:10 +01:00
|
|
|
}
|
|
|
|
|
2008-03-14 20:35:24 +01:00
|
|
|
static void
|
2008-03-20 20:45:08 +01:00
|
|
|
config_section_titlebar_init(cfg_t *cfg_titlebar, Titlebar *tb, int screen)
|
2008-03-14 20:35:24 +01:00
|
|
|
{
|
2008-03-21 10:53:17 +01:00
|
|
|
int phys_screen = screen_virttophys(screen);
|
2008-03-20 20:45:08 +01:00
|
|
|
cfg_t *cfg_styles = cfg_getsec(cfg_titlebar, "styles");
|
|
|
|
|
2008-03-19 11:58:43 +01:00
|
|
|
tb->position = tb->dposition = cfg_getposition(cfg_titlebar, "position");
|
2008-03-24 17:42:45 +01:00
|
|
|
tb->align = cfg_getalignment(cfg_titlebar, "align");
|
2008-03-19 12:05:36 +01:00
|
|
|
tb->text_align = cfg_getalignment(cfg_titlebar, "text_align");
|
2008-03-24 16:31:02 +01:00
|
|
|
tb->width = cfg_getint(cfg_titlebar, "width");
|
|
|
|
tb->height = cfg_getint(cfg_titlebar, "height");
|
2008-03-20 20:45:08 +01:00
|
|
|
draw_style_init(globalconf.display, phys_screen,
|
|
|
|
cfg_getsec(cfg_styles, "normal"),
|
|
|
|
&tb->styles.normal,
|
|
|
|
&globalconf.screens[screen].styles.normal);
|
|
|
|
draw_style_init(globalconf.display, phys_screen,
|
|
|
|
cfg_getsec(cfg_styles, "focus"),
|
|
|
|
&tb->styles.focus,
|
|
|
|
&globalconf.screens[screen].styles.focus);
|
|
|
|
draw_style_init(globalconf.display, phys_screen,
|
|
|
|
cfg_getsec(cfg_styles, "urgent"),
|
|
|
|
&tb->styles.urgent,
|
|
|
|
&globalconf.screens[screen].styles.urgent);
|
2008-03-14 20:35:24 +01:00
|
|
|
}
|
|
|
|
|
2007-12-27 23:18:50 +01:00
|
|
|
static void
|
|
|
|
config_parse_screen(cfg_t *cfg, int screen)
|
|
|
|
{
|
|
|
|
char buf[2];
|
|
|
|
const char *tmp;
|
2008-02-13 18:26:08 +01:00
|
|
|
FloatingPlacement flpl;
|
2007-12-27 23:18:50 +01:00
|
|
|
Layout *layout = NULL;
|
|
|
|
Tag *tag = NULL;
|
2007-12-30 21:00:34 +01:00
|
|
|
Statusbar *statusbar = NULL;
|
2008-03-14 08:35:06 +01:00
|
|
|
cfg_t *cfg_general, *cfg_styles, *cfg_screen, *cfg_tags,
|
2008-03-14 20:35:24 +01:00
|
|
|
*cfg_layouts, *cfg_padding, *cfgsectmp, *cfg_titlebar,
|
2008-03-14 08:35:06 +01:00
|
|
|
*cfg_styles_normal, *cfg_styles_focus, *cfg_styles_urgent;
|
2007-12-27 23:18:50 +01:00
|
|
|
VirtScreen *virtscreen = &globalconf.screens[screen];
|
2008-03-21 10:53:17 +01:00
|
|
|
int i, phys_screen = screen_virttophys(screen);
|
2007-12-27 23:18:50 +01:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%d", screen);
|
|
|
|
cfg_screen = cfg_gettsec(cfg, "screen", buf);
|
|
|
|
if(!cfg_screen)
|
|
|
|
cfg_screen = cfg_getsec(cfg, "screen");
|
|
|
|
|
|
|
|
if(!cfg_screen)
|
|
|
|
{
|
|
|
|
warn("parsing configuration file failed, no screen section found\n");
|
|
|
|
cfg_parse_buf(cfg, AWESOME_DEFAULT_CONFIG);
|
|
|
|
cfg_screen = cfg_getsec(cfg, "screen");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get screen specific sections */
|
|
|
|
cfg_tags = cfg_getsec(cfg_screen, "tags");
|
2008-03-14 08:35:06 +01:00
|
|
|
cfg_styles = cfg_getsec(cfg_screen, "styles");
|
2007-12-27 23:18:50 +01:00
|
|
|
cfg_general = cfg_getsec(cfg_screen, "general");
|
2008-03-14 20:35:24 +01:00
|
|
|
cfg_titlebar = cfg_getsec(cfg_screen, "titlebar");
|
2007-12-27 23:18:50 +01:00
|
|
|
cfg_layouts = cfg_getsec(cfg_screen, "layouts");
|
|
|
|
cfg_padding = cfg_getsec(cfg_screen, "padding");
|
|
|
|
|
|
|
|
|
|
|
|
/* General section */
|
|
|
|
virtscreen->borderpx = cfg_getint(cfg_general, "border");
|
|
|
|
virtscreen->snap = cfg_getint(cfg_general, "snap");
|
|
|
|
virtscreen->resize_hints = cfg_getbool(cfg_general, "resize_hints");
|
2008-01-04 14:40:26 +01:00
|
|
|
virtscreen->sloppy_focus = cfg_getbool(cfg_general, "sloppy_focus");
|
2008-01-25 23:27:32 +01:00
|
|
|
virtscreen->sloppy_focus_raise = cfg_getbool(cfg_general, "sloppy_focus_raise");
|
2008-01-04 17:53:28 +01:00
|
|
|
virtscreen->new_become_master = cfg_getbool(cfg_general, "new_become_master");
|
2008-01-07 18:54:45 +01:00
|
|
|
virtscreen->new_get_focus = cfg_getbool(cfg_general, "new_get_focus");
|
2008-03-23 20:38:16 +01:00
|
|
|
virtscreen->opacity_unfocused = cfg_getfloat(cfg_general, "opacity_unfocused");
|
|
|
|
virtscreen->opacity_focused = cfg_getfloat(cfg_general, "opacity_focused");
|
2008-02-13 18:04:20 +01:00
|
|
|
virtscreen->floating_placement =
|
|
|
|
name_func_lookup(cfg_getstr(cfg_general, "floating_placement"),
|
|
|
|
FloatingPlacementList);
|
2008-03-08 10:48:15 +01:00
|
|
|
virtscreen->mwfact_lower_limit = cfg_getfloat(cfg_general, "mwfact_lower_limit");
|
|
|
|
virtscreen->mwfact_upper_limit = cfg_getfloat(cfg_general, "mwfact_upper_limit");
|
|
|
|
|
|
|
|
if(virtscreen->mwfact_upper_limit < virtscreen->mwfact_lower_limit)
|
|
|
|
{
|
|
|
|
warn("mwfact_upper_limit must be greater than mwfact_lower_limit\n");
|
|
|
|
virtscreen->mwfact_upper_limit = 0.9;
|
|
|
|
virtscreen->mwfact_lower_limit = 0.1;
|
|
|
|
}
|
|
|
|
|
2008-02-13 18:26:08 +01:00
|
|
|
if(!virtscreen->floating_placement)
|
|
|
|
{
|
|
|
|
warn("unknown floating placement: %s\n", cfg_getstr(cfg_general, "floating_placement"));
|
|
|
|
virtscreen->floating_placement = FloatingPlacementList[0].func;
|
|
|
|
}
|
|
|
|
|
2007-12-27 23:18:50 +01:00
|
|
|
/* Colors */
|
2008-03-14 08:35:06 +01:00
|
|
|
if(!cfg_styles)
|
2008-03-13 18:53:11 +01:00
|
|
|
eprint("no colors section found");
|
|
|
|
|
2008-03-14 08:35:06 +01:00
|
|
|
if(!(cfg_styles_normal = cfg_getsec(cfg_styles, "normal")))
|
|
|
|
eprint("no normal colors section found\n");
|
|
|
|
if(!(cfg_styles_focus = cfg_getsec(cfg_styles, "focus")))
|
|
|
|
eprint("no focus colors section found\n");
|
|
|
|
if(!(cfg_styles_urgent = cfg_getsec(cfg_styles, "urgent")))
|
|
|
|
eprint("no urgent colors section found\n");
|
2008-03-13 17:57:38 +01:00
|
|
|
|
2008-03-14 08:35:06 +01:00
|
|
|
draw_style_init(globalconf.display, phys_screen,
|
|
|
|
cfg_styles_normal, &virtscreen->styles.normal, NULL);
|
|
|
|
draw_style_init(globalconf.display, phys_screen,
|
|
|
|
cfg_styles_focus, &virtscreen->styles.focus, &virtscreen->styles.normal);
|
|
|
|
draw_style_init(globalconf.display, phys_screen,
|
|
|
|
cfg_styles_urgent, &virtscreen->styles.urgent, &virtscreen->styles.normal);
|
2007-12-27 23:18:50 +01:00
|
|
|
|
2008-03-14 08:35:06 +01:00
|
|
|
if(!virtscreen->styles.normal.font)
|
|
|
|
eprint("no font available\n");
|
2007-12-27 23:18:50 +01:00
|
|
|
|
2008-03-20 20:45:08 +01:00
|
|
|
/* Titlebar */
|
|
|
|
config_section_titlebar_init(cfg_titlebar, &virtscreen->titlebar_default, screen);
|
|
|
|
|
2008-03-14 08:35:06 +01:00
|
|
|
/* Statusbar */
|
2008-01-12 21:39:41 +01:00
|
|
|
statusbar_list_init(&virtscreen->statusbar);
|
2008-01-12 22:15:06 +01:00
|
|
|
for(i = cfg_size(cfg_screen, "statusbar") - 1; i >= 0; i--)
|
2007-12-30 21:00:34 +01:00
|
|
|
{
|
2008-01-12 21:39:41 +01:00
|
|
|
statusbar = p_new(Statusbar, 1);
|
2008-01-12 22:15:06 +01:00
|
|
|
cfgsectmp = cfg_getnsec(cfg_screen, "statusbar", i);
|
2008-01-12 21:39:41 +01:00
|
|
|
statusbar->position = statusbar->dposition =
|
2008-03-19 11:58:43 +01:00
|
|
|
cfg_getposition(cfgsectmp, "position");
|
2008-01-12 21:39:41 +01:00
|
|
|
statusbar->height = cfg_getint(cfgsectmp, "height");
|
|
|
|
statusbar->width = cfg_getint(cfgsectmp, "width");
|
|
|
|
statusbar->name = a_strdup(cfg_title(cfgsectmp));
|
2008-01-16 17:50:37 +01:00
|
|
|
statusbar->screen = screen;
|
|
|
|
statusbar_preinit(statusbar);
|
2008-03-20 08:42:13 +01:00
|
|
|
statusbar_widgets_create(cfgsectmp, statusbar);
|
2008-01-16 16:43:23 +01:00
|
|
|
statusbar_list_push(&virtscreen->statusbar, statusbar);
|
2007-12-30 21:00:34 +01:00
|
|
|
}
|
2007-12-27 23:18:50 +01:00
|
|
|
|
|
|
|
/* Layouts */
|
2008-01-12 22:15:06 +01:00
|
|
|
layout_list_init(&virtscreen->layouts);
|
|
|
|
if((i = cfg_size(cfg_layouts, "layout")))
|
|
|
|
for(--i; i >= 0; i--)
|
2007-12-27 23:18:50 +01:00
|
|
|
{
|
2008-01-12 22:15:06 +01:00
|
|
|
layout = p_new(Layout, 1);
|
2007-12-27 23:18:50 +01:00
|
|
|
cfgsectmp = cfg_getnsec(cfg_layouts, "layout", i);
|
2008-01-12 21:36:24 +01:00
|
|
|
layout->arrange = name_func_lookup(cfg_title(cfgsectmp), LayoutList);
|
2007-12-27 23:18:50 +01:00
|
|
|
if(!layout->arrange)
|
|
|
|
{
|
|
|
|
warn("unknown layout %s in configuration file\n", cfg_title(cfgsectmp));
|
|
|
|
layout->image = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
layout->image = a_strdup(cfg_getstr(cfgsectmp, "image"));
|
|
|
|
|
2008-01-12 22:15:06 +01:00
|
|
|
layout_list_push(&virtscreen->layouts, layout);
|
2007-12-27 23:18:50 +01:00
|
|
|
}
|
|
|
|
else
|
2007-12-27 23:28:33 +01:00
|
|
|
{
|
2007-12-30 21:00:34 +01:00
|
|
|
warn("no default layout available\n");
|
2008-03-14 07:23:06 +01:00
|
|
|
layout = p_new(Layout, 1);
|
2007-12-27 23:28:33 +01:00
|
|
|
layout->arrange = layout_tile;
|
2008-03-14 07:23:06 +01:00
|
|
|
layout_list_push(&virtscreen->layouts, layout);
|
2007-12-27 23:28:33 +01:00
|
|
|
}
|
2007-12-27 23:18:50 +01:00
|
|
|
|
|
|
|
/* Tags */
|
2008-01-12 21:53:58 +01:00
|
|
|
tag_list_init(&virtscreen->tags);
|
2008-01-12 22:15:06 +01:00
|
|
|
if((i = cfg_size(cfg_tags, "tag")))
|
|
|
|
for(--i; i >= 0; i--)
|
2007-12-27 23:18:50 +01:00
|
|
|
{
|
2008-01-12 22:15:06 +01:00
|
|
|
cfgsectmp = cfg_getnsec(cfg_tags, "tag", i);
|
2008-01-17 18:27:55 +01:00
|
|
|
|
2007-12-27 23:18:50 +01:00
|
|
|
tmp = cfg_getstr(cfgsectmp, "layout");
|
|
|
|
for(layout = virtscreen->layouts;
|
2008-01-17 18:27:55 +01:00
|
|
|
layout && layout->arrange != name_func_lookup(tmp, LayoutList);
|
|
|
|
layout = layout->next);
|
2007-12-27 23:18:50 +01:00
|
|
|
if(!layout)
|
2008-01-17 18:27:55 +01:00
|
|
|
layout = virtscreen->layouts;
|
|
|
|
|
|
|
|
tag = tag_new(cfg_title(cfgsectmp),
|
|
|
|
layout,
|
|
|
|
cfg_getfloat(cfgsectmp, "mwfact"),
|
|
|
|
cfg_getint(cfgsectmp, "nmaster"),
|
|
|
|
cfg_getint(cfgsectmp, "ncol"));
|
|
|
|
|
|
|
|
tag_push_to_screen(tag, screen);
|
2007-12-27 23:18:50 +01:00
|
|
|
}
|
|
|
|
else
|
2007-12-27 23:28:33 +01:00
|
|
|
{
|
|
|
|
warn("fatal: no tags found in configuration file\n");
|
2008-03-14 07:27:23 +01:00
|
|
|
tag = tag_new("default", virtscreen->layouts, 0.5, 1, 1);
|
|
|
|
tag_push_to_screen(tag, screen);
|
2007-12-27 23:28:33 +01:00
|
|
|
}
|
2007-12-27 23:18:50 +01:00
|
|
|
|
|
|
|
/* select first tag by default */
|
|
|
|
virtscreen->tags[0].selected = True;
|
|
|
|
virtscreen->tags[0].was_selected = True;
|
|
|
|
|
|
|
|
/* padding */
|
|
|
|
virtscreen->padding.top = cfg_getint(cfg_padding, "top");
|
|
|
|
virtscreen->padding.bottom = cfg_getint(cfg_padding, "bottom");
|
|
|
|
virtscreen->padding.left = cfg_getint(cfg_padding, "left");
|
|
|
|
virtscreen->padding.right = cfg_getint(cfg_padding, "right");
|
|
|
|
}
|
|
|
|
|
2007-09-05 20:15:00 +02:00
|
|
|
/** Parse configuration file and initialize some stuff
|
2007-12-19 04:26:20 +01:00
|
|
|
* \param confpatharg Path to configuration file
|
2007-09-05 20:15:00 +02:00
|
|
|
*/
|
|
|
|
void
|
2007-12-16 13:22:13 +01:00
|
|
|
config_parse(const char *confpatharg)
|
2007-09-05 20:15:00 +02:00
|
|
|
{
|
2007-12-27 23:18:50 +01:00
|
|
|
cfg_t *cfg, *cfg_rules, *cfg_keys, *cfg_mouse, *cfgsectmp;
|
2008-01-12 20:45:12 +01:00
|
|
|
int ret, screen, i;
|
2007-12-27 23:18:50 +01:00
|
|
|
char *confpath;
|
2007-11-12 19:25:10 +01:00
|
|
|
Rule *rule = NULL;
|
2007-12-13 11:04:48 +01:00
|
|
|
FILE *defconfig = NULL;
|
2007-09-05 20:15:00 +02:00
|
|
|
|
2007-09-26 21:22:30 +02:00
|
|
|
if(confpatharg)
|
|
|
|
confpath = a_strdup(confpatharg);
|
|
|
|
else
|
2008-01-31 10:21:03 +01:00
|
|
|
confpath = config_file();
|
2007-09-05 20:15:00 +02:00
|
|
|
|
2007-12-16 02:45:38 +01:00
|
|
|
globalconf.configpath = a_strdup(confpath);
|
2007-11-08 11:22:25 +01:00
|
|
|
|
2008-03-18 13:00:10 +01:00
|
|
|
cfg = cfg_new();
|
2007-10-08 18:45:05 +02:00
|
|
|
|
2007-10-31 15:11:39 +01:00
|
|
|
ret = cfg_parse(cfg, confpath);
|
2008-01-24 10:47:01 +01:00
|
|
|
|
|
|
|
switch(ret)
|
2007-12-10 11:54:00 +01:00
|
|
|
{
|
2008-01-24 10:47:01 +01:00
|
|
|
case CFG_FILE_ERROR:
|
2008-03-19 13:11:13 +01:00
|
|
|
warn("parsing configuration file failed: %s\n", strerror(errno));
|
2007-12-13 11:04:48 +01:00
|
|
|
if(!(defconfig = fopen(confpath, "w")))
|
2008-03-19 13:11:13 +01:00
|
|
|
warn("unable to create default configuration file: %s\n", strerror(errno));
|
2008-01-24 10:47:01 +01:00
|
|
|
break;
|
|
|
|
case CFG_PARSE_ERROR:
|
2008-03-19 13:11:13 +01:00
|
|
|
cfg_error(cfg, "W: awesome: parsing configuration file %s failed.\n", confpath);
|
2008-01-24 10:47:01 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ret != CFG_SUCCESS)
|
|
|
|
{
|
|
|
|
warn("using default compile-time configuration\n");
|
2008-01-05 09:24:43 +01:00
|
|
|
cfg_free(cfg);
|
2008-01-31 11:45:10 +01:00
|
|
|
cfg = cfg_init(awesome_opts, CFGF_NONE);
|
2008-01-05 09:24:43 +01:00
|
|
|
cfg_parse_buf(cfg, AWESOME_DEFAULT_CONFIG);
|
|
|
|
}
|
2007-10-03 17:26:14 +02:00
|
|
|
|
2007-11-09 14:45:43 +01:00
|
|
|
/* get the right screen section */
|
2008-03-13 09:28:21 +01:00
|
|
|
for(screen = 0; screen < globalconf.screens_info->nscreen; screen++)
|
2007-12-27 23:18:50 +01:00
|
|
|
config_parse_screen(cfg, screen);
|
2007-09-06 21:53:45 +02:00
|
|
|
|
2007-12-11 20:56:51 +01:00
|
|
|
/* get general sections */
|
|
|
|
cfg_rules = cfg_getsec(cfg, "rules");
|
|
|
|
cfg_keys = cfg_getsec(cfg, "keys");
|
|
|
|
cfg_mouse = cfg_getsec(cfg, "mouse");
|
2007-09-18 22:49:34 +02:00
|
|
|
|
2007-10-08 18:45:05 +02:00
|
|
|
/* Rules */
|
2008-01-12 20:45:12 +01:00
|
|
|
rule_list_init(&globalconf.rules);
|
|
|
|
for(i = cfg_size(cfg_rules, "rule") - 1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
rule = p_new(Rule, 1);
|
|
|
|
cfgsectmp = cfg_getnsec(cfg_rules, "rule", i);
|
|
|
|
rule->prop_r = rules_compile_regex(cfg_getstr(cfgsectmp, "name"));
|
|
|
|
rule->tags_r = rules_compile_regex(cfg_getstr(cfgsectmp, "tags"));
|
|
|
|
rule->xprop = a_strdup(cfg_getstr(cfgsectmp, "xproperty_name"));
|
|
|
|
rule->xpropval_r = rules_compile_regex(cfg_getstr(cfgsectmp, "xproperty_value"));
|
|
|
|
rule->icon = a_strdup(cfg_getstr(cfgsectmp, "icon"));
|
2008-02-05 17:31:37 +01:00
|
|
|
rule->isfloating = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "float"));
|
2008-01-12 20:45:12 +01:00
|
|
|
rule->screen = cfg_getint(cfgsectmp, "screen");
|
2008-02-05 17:31:37 +01:00
|
|
|
rule->ismaster = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "master"));
|
2008-01-25 23:48:24 +01:00
|
|
|
rule->opacity = cfg_getfloat(cfgsectmp, "opacity");
|
2008-03-20 20:45:08 +01:00
|
|
|
config_section_titlebar_init(cfg_getsec(cfgsectmp, "titlebar"), &rule->titlebar, 0);
|
2008-03-13 09:28:21 +01:00
|
|
|
if(rule->screen >= globalconf.screens_info->nscreen)
|
2008-01-12 20:45:12 +01:00
|
|
|
rule->screen = 0;
|
|
|
|
|
|
|
|
rule_list_push(&globalconf.rules, rule);
|
2007-09-18 22:49:34 +02:00
|
|
|
}
|
|
|
|
|
2007-11-12 10:53:48 +01:00
|
|
|
/* Mouse: root window click bindings */
|
2007-12-16 02:45:38 +01:00
|
|
|
globalconf.buttons.root = parse_mouse_bindings(cfg_mouse, "root", True);
|
2007-11-12 10:53:48 +01:00
|
|
|
|
2007-11-14 17:18:16 +01:00
|
|
|
/* Mouse: client windows click bindings */
|
2007-12-16 02:45:38 +01:00
|
|
|
globalconf.buttons.client = parse_mouse_bindings(cfg_mouse, "client", True);
|
2007-11-14 17:18:16 +01:00
|
|
|
|
2008-03-19 15:34:07 +01:00
|
|
|
/* Mouse: titlebar windows click bindings */
|
|
|
|
globalconf.buttons.titlebar = parse_mouse_bindings(cfg_mouse, "titlebar", True);
|
|
|
|
|
2007-10-08 18:45:05 +02:00
|
|
|
/* Keys */
|
2008-03-21 11:26:56 +01:00
|
|
|
globalconf.numlockmask = xgetnumlockmask(globalconf.display);
|
2007-11-12 17:22:40 +01:00
|
|
|
|
2007-12-16 02:45:38 +01:00
|
|
|
globalconf.keys = section_keys(cfg_keys);
|
2007-09-05 20:15:00 +02:00
|
|
|
|
2007-12-13 11:04:48 +01:00
|
|
|
if(defconfig)
|
|
|
|
{
|
2008-02-29 15:36:13 +01:00
|
|
|
fwrite(AWESOME_DEFAULT_CONFIG, a_strlen(AWESOME_DEFAULT_CONFIG), 1, defconfig);
|
2007-12-13 11:04:48 +01:00
|
|
|
fclose(defconfig);
|
|
|
|
}
|
|
|
|
|
2007-10-08 18:45:05 +02:00
|
|
|
/* Free! Like a river! */
|
|
|
|
cfg_free(cfg);
|
2007-09-05 20:15:00 +02:00
|
|
|
p_delete(&confpath);
|
|
|
|
}
|
|
|
|
|
2007-12-18 09:24:15 +01:00
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|