There are now secondary config options that match the command line flags if the original options didn't

This commit is contained in:
Scoopta 2019-11-01 16:57:24 -07:00
parent 8093c05fe1
commit 2d08672f86

View File

@ -397,6 +397,7 @@ int main(int argc, char** argv) {
//Check if --style was specified //Check if --style was specified
if(style_str == NULL) { if(style_str == NULL) {
style_str = map_get(config, "stylesheet"); style_str = map_get(config, "stylesheet");
style_str = style_str == NULL ? map_get(config, "style") : style_str;
if(style_str == NULL) { if(style_str == NULL) {
const char* style_f = "/style.css"; const char* style_f = "/style.css";
stylesheet = utils_concat(2, CONFIG_LOCATION, style_f); stylesheet = utils_concat(2, CONFIG_LOCATION, style_f);
@ -414,6 +415,7 @@ int main(int argc, char** argv) {
//Check if --color was specified //Check if --color was specified
if(color_str == NULL) { if(color_str == NULL) {
color_str = map_get(config, "colors"); color_str = map_get(config, "colors");
color_str = color_str == NULL ? map_get(config, "color") : color_str;
if(color_str == NULL) { if(color_str == NULL) {
color_path = strdup(COLORS_LOCATION); color_path = strdup(COLORS_LOCATION);
} else { } else {
@ -429,6 +431,10 @@ int main(int argc, char** argv) {
free(COLORS_LOCATION); free(COLORS_LOCATION);
if(map_get(config, "show") != NULL) {
map_put(config, "mode", map_get(config, "show"));
}
if(strcmp(get_exec_name(argv[0]), "dmenu") == 0) { if(strcmp(get_exec_name(argv[0]), "dmenu") == 0) {
map_put(config, "mode", "dmenu"); map_put(config, "mode", "dmenu");
} else if(mode != NULL) { } else if(mode != NULL) {
@ -449,9 +455,15 @@ int main(int argc, char** argv) {
if(prompt != NULL) { if(prompt != NULL) {
map_put(config, "prompt", prompt); map_put(config, "prompt", prompt);
} }
if(map_get(config, "xoffset") != NULL) {
map_put(config, "x", map_get(config, "xoffset"));
}
if(x != NULL) { if(x != NULL) {
map_put(config, "x", x); map_put(config, "x", x);
} }
if(map_get(config, "yoffset") != NULL) {
map_put(config, "y", map_get(config, "yoffset"));
}
if(y != NULL) { if(y != NULL) {
map_put(config, "y", y); map_put(config, "y", y);
} }
@ -470,6 +482,9 @@ int main(int argc, char** argv) {
if(terminal != NULL) { if(terminal != NULL) {
map_put(config, "term", terminal); map_put(config, "term", terminal);
} }
if(map_get(config, "password") != NULL) {
map_put(config, "password_char", map_get(config, "password"));
}
if(password_char == NULL || (password_char != NULL && strcmp(password_char, "false") != 0)) { if(password_char == NULL || (password_char != NULL && strcmp(password_char, "false") != 0)) {
if(password_char == NULL) { if(password_char == NULL) {
password_char = "*"; password_char = "*";