Merge pull request #49 from abendebury/upstream-keylayout

Added support for setting status font
pull/266/head
Chris Guillott 2017-11-22 06:07:30 -05:00 committed by GitHub
commit cf6b6ee989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 23 deletions

View File

@ -52,12 +52,13 @@ Many little improvements have been made to i3lock over time:
- `--datecolor=rrggbbaa` -- color of the date string
- `--datefont="sans-serif"` -- font used for the date display
- `--datesize=14` -- font size for the date display
- `--veriftext="verifying…"` -- text to be shown while verifying
- `--wrongtext="wrong!"` -- text to be shown upon an incorrect password being entered
- `--textsize=28` -- font size for the status text
- `--modsize=14` -- font size for the modifier keys listing
- `--radius=90` -- the radius of the circle indicator
- `--ring-width=7` -- the width of the indicator ring
- `--veriftext="verifying…"` -- text to be shown while verifying
- `--wrongtext="wrong!"` -- text to be shown upon an incorrect password being entered
- `--statusfont="sans-serif"` -- font used for the status text
- `--textsize=28` -- font size for the status text
- `--modsize=14` -- font size for the modifier keys listing
- `--radius=90` -- the radius of the circle indicator
- `--ring-width=7` -- the width of the indicator ring
- You can specify whether i3lock should bell upon a wrong password.

View File

@ -106,6 +106,7 @@ char time_format[32] = "%H:%M:%S\0";
char date_format[32] = "%A, %m %Y\0";
char time_font[32] = "sans-serif\0";
char date_font[32] = "sans-serif\0";
char status_font[32] = "sans-serif\0";
char layout_font[32] = "sans-serif\0";
char ind_x_expr[32] = "x + (w / 2)\0";
char ind_y_expr[32] = "y + (h / 2)\0";
@ -1038,6 +1039,7 @@ int main(int argc, char *argv[]) {
{"keylayout", required_argument, NULL, 0},
{"timefont", required_argument, NULL, 0},
{"datefont", required_argument, NULL, 0},
{"statusfont", required_argument, NULL, 0},
{"layoutfont", required_argument, NULL, 0},
{"timesize", required_argument, NULL, 0},
{"datesize", required_argument, NULL, 0},
@ -1324,6 +1326,14 @@ int main(int argc, char *argv[]) {
}
strcpy(date_font,optarg);
}
else if (strcmp(longopts[longoptind].name, "statusfont") == 0) {
//read in to status_font
if (strlen(optarg) > 31) {
errx(1, "status font string can be at most 31 "
"characters\n");
}
strcpy(status_font,optarg);
}
else if (strcmp(longopts[longoptind].name, "timesize") == 0) {
char *arg = optarg;

View File

@ -96,6 +96,7 @@ extern char time_format[32];
extern char date_format[32];
extern char time_font[32];
extern char date_font[32];
extern char status_font[32];
extern char layout_font[32];
extern char ind_x_expr[32];
extern char ind_y_expr[32];
@ -397,7 +398,8 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
char buf[4];
cairo_set_source_rgba(ctx, (double)text16->red/255, (double)text16->green/255, (double)text16->blue/255, (double)text16->alpha/255);
cairo_select_font_face(ctx, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face(ctx, status_font, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(ctx, text_size);
switch (auth_state) {
case STATE_AUTH_VERIFY: