center added
This commit is contained in:
parent
8dbfef87e9
commit
b24ce51172
@ -2,10 +2,11 @@
|
|||||||
/* Default settings; can be overriden by command line. */
|
/* Default settings; can be overriden by command line. */
|
||||||
|
|
||||||
static int mon = -1;
|
static int mon = -1;
|
||||||
static int bottom = 0;
|
|
||||||
static int embedded = 0;
|
|
||||||
static int minpwlen = 32;
|
|
||||||
|
|
||||||
|
static unsigned int center = 0;
|
||||||
|
static unsigned int bottom = 0;
|
||||||
|
static unsigned int embedded = 0;
|
||||||
|
static unsigned int minpwlen = 32;
|
||||||
static unsigned int lineheight = 22;
|
static unsigned int lineheight = 22;
|
||||||
static unsigned int borderwidth = 2;
|
static unsigned int borderwidth = 2;
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@ You can change the path to the config file with the environment variable
|
|||||||
.BI "monitor =" " -1"
|
.BI "monitor =" " -1"
|
||||||
pinentry-dmenu is displayed on the monitor number supplied. Monitor numbers are starting from 0.
|
pinentry-dmenu is displayed on the monitor number supplied. Monitor numbers are starting from 0.
|
||||||
.TP
|
.TP
|
||||||
|
.BI "center =" " false"
|
||||||
|
pinentry-dmenu appears in the center of the screen.
|
||||||
|
.TP
|
||||||
.BI "bottom =" " false"
|
.BI "bottom =" " false"
|
||||||
pinentry-dmenu appears at the bottom of the screen.
|
pinentry-dmenu appears at the bottom of the screen.
|
||||||
.TP
|
.TP
|
||||||
@ -192,12 +195,13 @@ Paste from primary X selection
|
|||||||
.\}
|
.\}
|
||||||
.nf
|
.nf
|
||||||
monitor = -1;
|
monitor = -1;
|
||||||
|
center = false;
|
||||||
bottom = false;
|
bottom = false;
|
||||||
embedded = false;
|
embedded = false;
|
||||||
line_height = 22;
|
line_height = 22;
|
||||||
border_width = 2;
|
border_width = 2;
|
||||||
font = "DejaVuSansMono Nerd Font:pixelsize=16:antialias=true:autohint=true";
|
font = "DejaVuSansMono Nerd Font:pixelsize=16:antialias=true:autohint=true";
|
||||||
min_passwword_length = 32;
|
min_password_length = 32;
|
||||||
asterisk= "*";
|
asterisk= "*";
|
||||||
prompt = "";
|
prompt = "";
|
||||||
prompt_fg = "#cccccc";
|
prompt_fg = "#cccccc";
|
||||||
|
@ -330,9 +330,16 @@ setup(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (center) {
|
||||||
|
mw = info[i].width;
|
||||||
|
x = info[i].x_org + ((info[i].width - mw) / 2);
|
||||||
|
y = info[i].y_org + ((info[i].height - mh) / 2);
|
||||||
|
} else {
|
||||||
x = info[i].x_org;
|
x = info[i].x_org;
|
||||||
y = info[i].y_org + (bottom ? info[i].height - mh : 0);
|
y = info[i].y_org + (bottom ? info[i].height - mh : 0);
|
||||||
mw = info[i].width;
|
mw = info[i].width;
|
||||||
|
}
|
||||||
|
|
||||||
XFree(info);
|
XFree(info);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
@ -340,10 +347,17 @@ setup(void) {
|
|||||||
if (!XGetWindowAttributes(dpy, parentwin, &wa)) {
|
if (!XGetWindowAttributes(dpy, parentwin, &wa)) {
|
||||||
die("could not get embedding window attributes: 0x%lx", parentwin);
|
die("could not get embedding window attributes: 0x%lx", parentwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (center) {
|
||||||
|
mw = wa.width;
|
||||||
|
x = (wa.width - mw) / 2;
|
||||||
|
y = (wa.height - mh) / 2;
|
||||||
|
} else {
|
||||||
x = 0;
|
x = 0;
|
||||||
y = bottom ? wa.height - mh : 0;
|
y = bottom ? wa.height - mh : 0;
|
||||||
mw = wa.width;
|
mw = wa.width;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pdescw = (pinentry_info->description) ? TEXTW(pinentry_info->description) : 0;
|
pdescw = (pinentry_info->description) ? TEXTW(pinentry_info->description) : 0;
|
||||||
|
|
||||||
@ -741,6 +755,9 @@ main(int argc, char *argv[]) {
|
|||||||
if (config_lookup_int(&cfg, "monitor", &val)) {
|
if (config_lookup_int(&cfg, "monitor", &val)) {
|
||||||
mon = val;
|
mon = val;
|
||||||
}
|
}
|
||||||
|
if (config_lookup_bool(&cfg, "center", &bval)) {
|
||||||
|
center = bval;
|
||||||
|
}
|
||||||
if (config_lookup_bool(&cfg, "bottom", &bval)) {
|
if (config_lookup_bool(&cfg, "bottom", &bval)) {
|
||||||
bottom = bval;
|
bottom = bval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user