Catch parameters '-W' and '--parent-wid' to get the window id

pull/4/head
Moritz Luedecke 7 years ago
parent f2f7ec7608
commit 301e7de62f

@ -583,56 +583,65 @@ main(int argc, char *argv[]) {
/* Read the file. If there is an error, report it and exit. */
if (config_read_file(&cfg, path)) {
if (config_lookup_string(&cfg, "asterisk", &str)) {
asterisk = str;
}
if (config_lookup_bool(&cfg, "buttom", &bval)) {
topbar = !bval;
}
if (config_lookup_int(&cfg, "min_password_length", &val)) {
minpwlen = val;
}
if (config_lookup_int(&cfg, "monitor", &val)) {
mon = val;
}
if (config_lookup_string(&cfg, "prompt", &str)) {
prompt = str;
}
if (config_lookup_string(&cfg, "font", &str)) {
fonts[0] = str;
}
if (config_lookup_string(&cfg, "prompt_bg", &str)) {
colors[SchemePrompt][ColBg] = str;
}
if (config_lookup_string(&cfg, "prompt_fg", &str)) {
colors[SchemePrompt][ColFg] = str;
}
if (config_lookup_string(&cfg, "normal_bg", &str)) {
colors[SchemeNormal][ColBg] = str;
}
if (config_lookup_string(&cfg, "normal_fg", &str)) {
colors[SchemeNormal][ColFg] = str;
}
if (config_lookup_string(&cfg, "select_bg", &str)) {
colors[SchemeSelect][ColBg] = str;
}
if (config_lookup_string(&cfg, "select_fg", &str)) {
colors[SchemeSelect][ColFg] = str;
}
if (config_lookup_string(&cfg, "desc_bg", &str)) {
colors[SchemeDesc][ColBg] = str;
}
if (config_lookup_string(&cfg, "desc_fg", &str)) {
colors[SchemeDesc][ColFg] = str;
}
if (config_lookup_bool(&cfg, "windowed", &bval)) {
windowed = bval;
}
} else if (str = config_error_file(&cfg)) {
fprintf(stderr, "%s:%d: %s\n", config_error_file(&cfg),
config_error_line(&cfg), config_error_text(&cfg));
config_destroy(&cfg);
return(EXIT_FAILURE);
} else {
printf("No config file found. Use defaults.\n");
}
if (config_lookup_string(&cfg, "asterisk", &str)) {
asterisk = str;
}
if (config_lookup_bool(&cfg, "buttom", &bval)) {
topbar = !bval;
}
if (config_lookup_int(&cfg, "min_password_length", &val)) {
minpwlen = val;
}
if (config_lookup_int(&cfg, "monitor", &val)) {
mon = val;
}
if (config_lookup_string(&cfg, "prompt", &str)) {
prompt = str;
}
if (config_lookup_string(&cfg, "font", &str)) {
fonts[0] = str;
}
if (config_lookup_string(&cfg, "prompt_bg", &str)) {
colors[SchemePrompt][ColBg] = str;
}
if (config_lookup_string(&cfg, "prompt_fg", &str)) {
colors[SchemePrompt][ColFg] = str;
}
if (config_lookup_string(&cfg, "normal_bg", &str)) {
colors[SchemeNormal][ColBg] = str;
}
if (config_lookup_string(&cfg, "normal_fg", &str)) {
colors[SchemeNormal][ColFg] = str;
}
if (config_lookup_string(&cfg, "select_bg", &str)) {
colors[SchemeSelect][ColBg] = str;
}
if (config_lookup_string(&cfg, "select_fg", &str)) {
colors[SchemeSelect][ColFg] = str;
}
if (config_lookup_string(&cfg, "desc_bg", &str)) {
colors[SchemeDesc][ColBg] = str;
}
if (config_lookup_string(&cfg, "desc_fg", &str)) {
colors[SchemeDesc][ColFg] = str;
}
if (config_lookup_string(&cfg, "window_id", &str)) {
embed = str;
for (i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-W") || !strcmp(argv[i], "--parent-wid")) {
if (windowed) {
embed = argv[++i];
printf("-> embed: %s\n", embed);
}
}
}
pinentry_init("pinentry-dmenu");

Loading…
Cancel
Save