Add src/config/config-dir.c

This commit is contained in:
Johan Malm 2020-07-18 11:28:39 +01:00
parent 7fc643fdb9
commit ccc818fda5
5 changed files with 102 additions and 6 deletions

View file

@ -8,7 +8,7 @@ struct rcxml rc = { 0 };
struct theme theme = { 0 };
static const char labwc_usage[] =
"Usage: labwc [-h] [-s <command>]\n";
"Usage: labwc [-h] [-s <startup-command>] [-c <config-file>]\n";
static void usage(void)
{
@ -19,14 +19,18 @@ static void usage(void)
int main(int argc, char *argv[])
{
char *startup_cmd = NULL;
char *config_file = NULL;
wlr_log_init(WLR_ERROR, NULL);
int c;
while ((c = getopt(argc, argv, "s:h")) != -1) {
while ((c = getopt(argc, argv, "s:c:h")) != -1) {
switch (c) {
case 's':
startup_cmd = optarg;
break;
case 'c':
config_file = optarg;
break;
default:
usage();
}
@ -34,7 +38,7 @@ int main(int argc, char *argv[])
if (optind < argc)
usage();
rcxml_read("data/rc.xml");
rcxml_read(config_file);
/* Wayland requires XDG_RUNTIME_DIR to be set */
if (!getenv("XDG_RUNTIME_DIR")) {