configuration optimized for menu position and some minor fixes
This commit is contained in:
parent
4e5c00ea38
commit
431d99aab6
3
README
3
README
@ -33,9 +33,7 @@ To use pinentry-dmenu add in `~/.gnupg/gpg-agent.conf`:
|
||||
The config is located in `~/.gnupg/pinentry-dmenu.conf`.
|
||||
|
||||
monitor = -1;
|
||||
center = false;
|
||||
center_width = 1024;
|
||||
bottom = false;
|
||||
embedded = false;
|
||||
line_height = 22;
|
||||
border_width = 2;
|
||||
@ -48,6 +46,7 @@ select_fg_alpha = 255;
|
||||
select_bg_alpha = 255;
|
||||
desc_fg_alpha = 255;
|
||||
desc_bg_alpha = 230;
|
||||
position = "center";
|
||||
font = "DejaVuSansMono Nerd Font:pixelsize=16:antialias=true:autohint=true";
|
||||
prompt = "";
|
||||
asterisk = "*";
|
||||
|
@ -2,9 +2,7 @@
|
||||
/* Default settings; can be overriden by pinentry-dmenu.conf */
|
||||
|
||||
static unsigned int mon = -1;
|
||||
static unsigned int center = 0;
|
||||
static unsigned int centerwidth = 1024;
|
||||
static unsigned int bottom = 0;
|
||||
static unsigned int embedded = 0;
|
||||
static unsigned int lineheight = 22;
|
||||
static unsigned int borderwidth = 2;
|
||||
@ -18,6 +16,7 @@ static unsigned int alphas[SchemeLast][2] = {
|
||||
[SchemeDesc] = { 255, 230 },
|
||||
};
|
||||
|
||||
static const char *position = "center";
|
||||
static const char *fonts[] = {
|
||||
"DejaVuSansMono Nerd Font:pixelsize=16:antialias=true:autohint=true"
|
||||
};
|
||||
|
@ -28,15 +28,9 @@ You can change the path to the config file with the environment variable
|
||||
.BI "monitor = " "-1"
|
||||
pinentry-dmenu is displayed on the monitor number supplied. Monitor numbers are starting from 0.
|
||||
.TP
|
||||
.BI "center =" " false"
|
||||
pinentry-dmenu appears in the center of the screen.
|
||||
.TP
|
||||
.BI "center_width = " "1024"
|
||||
Defines the width for the 'center' menu.
|
||||
.TP
|
||||
.BI "bottom =" " false"
|
||||
pinentry-dmenu appears at the bottom of the screen.
|
||||
.TP
|
||||
.BI "embedded = " "false"
|
||||
Embed into window.
|
||||
.TP
|
||||
@ -78,40 +72,48 @@ Defines the description foreground alpha value.
|
||||
.BI "desc_bg_alpha = " "230"
|
||||
Defines the description background alpha value.
|
||||
.TP
|
||||
.BI "font =" " DejaVuSansMono Nerd Font:pixelsize=16:antialias=true:autohint=true"
|
||||
.BI "position = " """center"""
|
||||
Defines the osition of the menu.
|
||||
.IR bottom ,
|
||||
.I center
|
||||
and
|
||||
.I top
|
||||
are supported.
|
||||
.TP
|
||||
.BI "font = " """DejaVuSansMono Nerd Font:pixelsize=16:antialias=true:autohint=true"""
|
||||
Defines the font or font set used.
|
||||
.TP
|
||||
.BI "prompt =" " """"
|
||||
.BI "prompt = " """"""
|
||||
Defines the prompt to be displayed to the left of the input field.
|
||||
.TP
|
||||
.BI "asterisk =" " *"
|
||||
.BI "asterisk = " """*"""
|
||||
Defines the symbol which is showed for each typed character.
|
||||
.TP
|
||||
.BI "prompt_fg =" " #cccccc"
|
||||
.BI "prompt_fg = " """#cccccc"""
|
||||
Defines the prompt foreground color.
|
||||
.IR #RGB ,
|
||||
.I #RRGGBB
|
||||
and X color names are supported.
|
||||
.TP
|
||||
.BI "prompt_bg =" " #4185d7"
|
||||
.BI "prompt_bg = " """#4185d7"""
|
||||
Defines the prompt background color.
|
||||
.TP
|
||||
.BI "normal_fg =" " #cccccc"
|
||||
.BI "normal_fg = " """#cccccc"""
|
||||
Defines the normal foreground color.
|
||||
.TP
|
||||
.BI "normal_bg =" " #000000"
|
||||
.BI "normal_bg = " """#000000"""
|
||||
Defines the normal background color.
|
||||
.TP
|
||||
.BI "select_fg =" " #ffffff"
|
||||
.BI "select_fg = " """#ffffff"""
|
||||
Defines the selected foreground color.
|
||||
.TP
|
||||
.BI "select_bg =" " #4185d7"
|
||||
.BI "select_bg = " """#4185d7"""
|
||||
Defines the selected background color.
|
||||
.TP
|
||||
.BI "desc_fg =" " #cccccc"
|
||||
.BI "desc_fg = " """#cccccc"""
|
||||
Defines the description foreground color.
|
||||
.TP
|
||||
.BI "desc_bg =" " #000000"
|
||||
.BI "desc_bg = " """#000000"""
|
||||
Defines the description background color.
|
||||
|
||||
.SH USAGE
|
||||
@ -227,9 +229,7 @@ Paste from primary X selection
|
||||
.\}
|
||||
.nf
|
||||
monitor = -1;
|
||||
center = false;
|
||||
center_width = 1024;
|
||||
bottom = false;
|
||||
embedded = false;
|
||||
line_height = 22;
|
||||
border_width = 2;
|
||||
@ -242,6 +242,7 @@ select_fg_alpha = 255;
|
||||
select_bg_alpha = 255;
|
||||
desc_fg_alpha = 255;
|
||||
desc_bg_alpha = 230;
|
||||
position = "center";
|
||||
font = "DejaVuSansMono Nerd Font:pixelsize=16:antialias=true:autohint=true";
|
||||
prompt = "";
|
||||
asterisk = "*";
|
||||
|
@ -48,6 +48,8 @@ static int lrpad;
|
||||
static size_t cursor;
|
||||
static int screen;
|
||||
|
||||
static int bottom = 0, center = 0;
|
||||
|
||||
static char* pin;
|
||||
static int pin_len;
|
||||
static char* pin_repeat;
|
||||
@ -272,7 +274,7 @@ drawwin(void) {
|
||||
|
||||
drw_setscheme(drw, scheme[SchemeDesc]);
|
||||
if (center) {
|
||||
drw_text(drw, ppromptw, lineheight, centerwidth,
|
||||
drw_text(drw, promptw + ppromptw, lineheight, centerwidth,
|
||||
bh + borderwidth, lrpad / 2,
|
||||
pinentry_info->description, 0);
|
||||
} else {
|
||||
@ -804,15 +806,9 @@ main(int argc, char *argv[]) {
|
||||
if (config_lookup_int(&cfg, "monitor", &val)) {
|
||||
mon = val;
|
||||
}
|
||||
if (config_lookup_bool(&cfg, "center", &bval)) {
|
||||
center = bval;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "center_width", &val)) {
|
||||
centerwidth = val;
|
||||
}
|
||||
if (config_lookup_bool(&cfg, "bottom", &bval)) {
|
||||
bottom = bval;
|
||||
}
|
||||
if (config_lookup_bool(&cfg, "embedded", &bval)) {
|
||||
embedded = bval;
|
||||
}
|
||||
@ -822,6 +818,33 @@ main(int argc, char *argv[]) {
|
||||
if (config_lookup_int(&cfg, "border_width", &val)) {
|
||||
borderwidth = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "prompt_fg_alpha", &val)) {
|
||||
alphas[SchemePrompt][0] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "prompt_bg_alpha", &val)) {
|
||||
alphas[SchemePrompt][1] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "normal_fg_alpha", &val)) {
|
||||
alphas[SchemeNormal][0] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "normal_bg_alpha", &val)) {
|
||||
alphas[SchemeNormal][1] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "select_fg_alpha", &val)) {
|
||||
alphas[SchemeSelect][0] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "select_bg_alpha", &val)) {
|
||||
alphas[SchemeSelect][1] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "desc_fg_alpha", &val)) {
|
||||
alphas[SchemeDesc][0] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "desc_bg_alpha", &val)) {
|
||||
alphas[SchemeDesc][1] = val;
|
||||
}
|
||||
if (config_lookup_string(&cfg, "position", &str)) {
|
||||
position = str;
|
||||
}
|
||||
if (config_lookup_string(&cfg, "font", &str)) {
|
||||
fonts[0] = str;
|
||||
}
|
||||
@ -858,30 +881,6 @@ main(int argc, char *argv[]) {
|
||||
if (config_lookup_string(&cfg, "desc_bg", &str)) {
|
||||
colors[SchemeDesc][ColBg] = str;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "prompt_fg_alpha", &val)) {
|
||||
alphas[SchemePrompt][0] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "prompt_bg_alpha", &val)) {
|
||||
alphas[SchemePrompt][1] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "normal_fg_alpha", &val)) {
|
||||
alphas[SchemeNormal][0] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "normal_bg_alpha", &val)) {
|
||||
alphas[SchemeNormal][1] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "select_fg_alpha", &val)) {
|
||||
alphas[SchemeSelect][0] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "select_bg_alpha", &val)) {
|
||||
alphas[SchemeSelect][1] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "desc_fg_alpha", &val)) {
|
||||
alphas[SchemeDesc][0] = val;
|
||||
}
|
||||
if (config_lookup_int(&cfg, "desc_bg_alpha", &val)) {
|
||||
alphas[SchemeDesc][1] = val;
|
||||
}
|
||||
} 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));
|
||||
@ -890,6 +889,15 @@ main(int argc, char *argv[]) {
|
||||
printf("No config file found. Use defaults.\n");
|
||||
}
|
||||
|
||||
if (0 == strcmp(position, "center")) {
|
||||
center = 1;
|
||||
bottom = 0;
|
||||
}
|
||||
if (0 == strcmp(position, "bottom")) {
|
||||
center = 0;
|
||||
bottom = 1;
|
||||
}
|
||||
|
||||
pinentry_init("pinentry-dmenu");
|
||||
pinentry_parse_opts(argc, argv);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user