mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
Add -m option to enable merging of config
This commit is contained in:
parent
ddadbb5b3c
commit
777a7ce624
1 changed files with 10 additions and 1 deletions
11
src/main.c
11
src/main.c
|
|
@ -22,6 +22,7 @@ static const struct option long_options[] = {
|
||||||
{"debug", no_argument, NULL, 'd'},
|
{"debug", no_argument, NULL, 'd'},
|
||||||
{"exit", no_argument, NULL, 'e'},
|
{"exit", no_argument, NULL, 'e'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
{"mergeconfig", no_argument, NULL, 'm'},
|
||||||
{"reconfigure", no_argument, NULL, 'r'},
|
{"reconfigure", no_argument, NULL, 'r'},
|
||||||
{"startup", required_argument, NULL, 's'},
|
{"startup", required_argument, NULL, 's'},
|
||||||
{"version", no_argument, NULL, 'v'},
|
{"version", no_argument, NULL, 'v'},
|
||||||
|
|
@ -36,6 +37,7 @@ static const char labwc_usage[] =
|
||||||
" -d, --debug Enable full logging, including debug information\n"
|
" -d, --debug Enable full logging, including debug information\n"
|
||||||
" -e, --exit Exit the compositor\n"
|
" -e, --exit Exit the compositor\n"
|
||||||
" -h, --help Show help message and quit\n"
|
" -h, --help Show help message and quit\n"
|
||||||
|
" -m, --mergeconfig Merge user rc.xml with system rc.xml\n"
|
||||||
" -r, --reconfigure Reload the compositor configuration\n"
|
" -r, --reconfigure Reload the compositor configuration\n"
|
||||||
" -s, --startup <command> Run command on startup\n"
|
" -s, --startup <command> Run command on startup\n"
|
||||||
" -v, --version Show version number and quit\n"
|
" -v, --version Show version number and quit\n"
|
||||||
|
|
@ -88,11 +90,12 @@ main(int argc, char *argv[])
|
||||||
char *startup_cmd = NULL;
|
char *startup_cmd = NULL;
|
||||||
char *config_file = NULL;
|
char *config_file = NULL;
|
||||||
enum wlr_log_importance verbosity = WLR_ERROR;
|
enum wlr_log_importance verbosity = WLR_ERROR;
|
||||||
|
bool merge_rc = false;
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while (1) {
|
while (1) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
c = getopt_long(argc, argv, "c:C:dehrs:vV", long_options, &index);
|
c = getopt_long(argc, argv, "c:C:dehmrs:vV", long_options, &index);
|
||||||
if (c == -1) {
|
if (c == -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -121,6 +124,9 @@ main(int argc, char *argv[])
|
||||||
case 'V':
|
case 'V':
|
||||||
verbosity = WLR_INFO;
|
verbosity = WLR_INFO;
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
merge_rc = true;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
|
@ -136,6 +142,9 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
if (!rc.config_dir) {
|
if (!rc.config_dir) {
|
||||||
rc.config_dir = config_dir();
|
rc.config_dir = config_dir();
|
||||||
|
if (merge_rc == false && !config_file) {
|
||||||
|
config_file = g_strdup_printf("%s/rc.xml", rc.config_dir);
|
||||||
|
}
|
||||||
} else if (!config_file) {
|
} else if (!config_file) {
|
||||||
config_file = g_strdup_printf("%s/rc.xml", rc.config_dir);
|
config_file = g_strdup_printf("%s/rc.xml", rc.config_dir);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue