diff options
author | Moritz Luedecke <ritze@skweez.net> | 2017-08-20 14:17:00 +0200 |
---|---|---|
committer | Moritz Luedecke <ritze@skweez.net> | 2017-08-20 14:17:00 +0200 |
commit | 301e7de62f85f49a7a4d6b52fd42efb9a34ca4e6 (patch) | |
tree | 33721f02de320061c1d1b29584cf6779fc43f7a2 /pinentry-dmenu.c | |
parent | f2f7ec7608504df71d7760212759d8d498f629ea (diff) |
Catch parameters '-W' and '--parent-wid' to get the window id
Diffstat (limited to 'pinentry-dmenu.c')
-rw-r--r-- | pinentry-dmenu.c | 101 |
1 files changed, 55 insertions, 46 deletions
diff --git a/pinentry-dmenu.c b/pinentry-dmenu.c index a761847..029e80f 100644 --- a/pinentry-dmenu.c +++ b/pinentry-dmenu.c @@ -583,58 +583,67 @@ 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; + 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); + } + } } - 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; - } - pinentry_init("pinentry-dmenu"); pinentry_parse_opts(argc, argv); |