Merge pull request #2240 from RedSoxFan/implement-1961

Implement swaylock customization flags
This commit is contained in:
Drew DeVault 2018-07-11 04:39:13 -07:00 committed by GitHub
commit edfe42032c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 394 additions and 116 deletions

View file

@ -19,9 +19,31 @@ enum auth_state {
AUTH_STATE_INVALID, AUTH_STATE_INVALID,
}; };
struct swaylock_colorset {
uint32_t input;
uint32_t cleared;
uint32_t verifying;
uint32_t wrong;
};
struct swaylock_colors {
uint32_t background;
uint32_t bs_highlight;
uint32_t key_highlight;
uint32_t separator;
struct swaylock_colorset inside;
struct swaylock_colorset line;
struct swaylock_colorset ring;
struct swaylock_colorset text;
};
struct swaylock_args { struct swaylock_args {
uint32_t color; struct swaylock_colors colors;
enum background_mode mode; enum background_mode mode;
char *font;
uint32_t radius;
uint32_t thickness;
bool ignore_empty;
bool show_indicator; bool show_indicator;
bool daemonize; bool daemonize;
}; };

View file

@ -89,7 +89,7 @@ static bool surface_is_opaque(struct swaylock_surface *surface) {
if (surface->image) { if (surface->image) {
return cairo_surface_get_content(surface->image) == CAIRO_CONTENT_COLOR; return cairo_surface_get_content(surface->image) == CAIRO_CONTENT_COLOR;
} }
return (surface->state->args.color & 0xff) == 0xff; return (surface->state->args.colors.background & 0xff) == 0xff;
} }
static void create_layer_surface(struct swaylock_surface *surface) { static void create_layer_surface(struct swaylock_surface *surface) {
@ -381,59 +381,225 @@ static void load_image(char *arg, struct swaylock_state *state) {
image->path, image->output_name ? image->output_name : "*"); image->path, image->output_name ? image->output_name : "*");
} }
static void set_default_colors(struct swaylock_colors *colors) {
colors->background = 0xFFFFFFFF;
colors->bs_highlight = 0xDB3300FF;
colors->key_highlight = 0x33DB00FF;
colors->separator = 0x000000FF;
colors->inside = (struct swaylock_colorset){
.input = 0x000000C0,
.cleared = 0xE5A445C0,
.verifying = 0x0072FFC0,
.wrong = 0xFA0000C0,
};
colors->line = (struct swaylock_colorset){
.input = 0x000000FF,
.cleared = 0x000000FF,
.verifying = 0x000000FF,
.wrong = 0x000000FF,
};
colors->ring = (struct swaylock_colorset){
.input = 0x337D00FF,
.cleared = 0xE5A445FF,
.verifying = 0x3300FFFF,
.wrong = 0x7D3300FF,
};
colors->text = (struct swaylock_colorset){
.input = 0xE5A445FF,
.cleared = 0x000000FF,
.verifying = 0x000000FF,
.wrong = 0x000000FF,
};
}
static struct swaylock_state state; static struct swaylock_state state;
int main(int argc, char **argv) { int main(int argc, char **argv) {
enum line_mode {
LM_LINE,
LM_INSIDE,
LM_RING,
};
enum long_option_codes {
LO_BS_HL_COLOR = 256,
LO_FONT,
LO_IND_RADIUS,
LO_IND_THICKNESS,
LO_INSIDE_COLOR,
LO_INSIDE_CLEAR_COLOR,
LO_INSIDE_VER_COLOR,
LO_INSIDE_WRONG_COLOR,
LO_KEY_HL_COLOR,
LO_LINE_COLOR,
LO_LINE_CLEAR_COLOR,
LO_LINE_VER_COLOR,
LO_LINE_WRONG_COLOR,
LO_RING_COLOR,
LO_RING_CLEAR_COLOR,
LO_RING_VER_COLOR,
LO_RING_WRONG_COLOR,
LO_SEP_COLOR,
LO_TEXT_COLOR,
LO_TEXT_CLEAR_COLOR,
LO_TEXT_VER_COLOR,
LO_TEXT_WRONG_COLOR,
};
static struct option long_options[] = { static struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
{"color", required_argument, NULL, 'c'}, {"color", required_argument, NULL, 'c'},
{"ignore-empty-password", no_argument, NULL, 'e'},
{"daemonize", no_argument, NULL, 'f'},
{"help", no_argument, NULL, 'h'},
{"image", required_argument, NULL, 'i'}, {"image", required_argument, NULL, 'i'},
{"line-uses-inside", no_argument, NULL, 'n'},
{"socket", required_argument, NULL, 'p'},
{"line-uses-ring", no_argument, NULL, 'r'},
{"scaling", required_argument, NULL, 's'}, {"scaling", required_argument, NULL, 's'},
{"tiling", no_argument, NULL, 't'}, {"tiling", no_argument, NULL, 't'},
{"version", no_argument, NULL, 'v'},
{"socket", required_argument, NULL, 'p'},
{"no-unlock-indicator", no_argument, NULL, 'u'}, {"no-unlock-indicator", no_argument, NULL, 'u'},
{"daemonize", no_argument, NULL, 'f'}, {"version", no_argument, NULL, 'v'},
{"bs-hl-color", required_argument, NULL, LO_BS_HL_COLOR},
{"font", required_argument, NULL, LO_FONT},
{"indicator-radius", required_argument, NULL, LO_IND_RADIUS},
{"indicator-thickness", required_argument, NULL, LO_IND_THICKNESS},
{"inside-color", required_argument, NULL, LO_INSIDE_COLOR},
{"inside-clear-color", required_argument, NULL, LO_INSIDE_CLEAR_COLOR},
{"inside-ver-color", required_argument, NULL, LO_INSIDE_VER_COLOR},
{"inside-wrong-color", required_argument, NULL, LO_INSIDE_WRONG_COLOR},
{"key-hl-color", required_argument, NULL, LO_KEY_HL_COLOR},
{"line-color", required_argument, NULL, LO_LINE_COLOR},
{"line-clear-color", required_argument, NULL, LO_LINE_CLEAR_COLOR},
{"line-ver-color", required_argument, NULL, LO_LINE_VER_COLOR},
{"line-wrong-color", required_argument, NULL, LO_LINE_WRONG_COLOR},
{"ring-color", required_argument, NULL, LO_RING_COLOR},
{"ring-clear-color", required_argument, NULL, LO_RING_CLEAR_COLOR},
{"ring-ver-color", required_argument, NULL, LO_RING_VER_COLOR},
{"ring-wrong-color", required_argument, NULL, LO_RING_WRONG_COLOR},
{"separator-color", required_argument, NULL, LO_SEP_COLOR},
{"text-color", required_argument, NULL, LO_TEXT_COLOR},
{"text-clear-color", required_argument, NULL, LO_TEXT_CLEAR_COLOR},
{"text-ver-color", required_argument, NULL, LO_TEXT_VER_COLOR},
{"text-wrong-color", required_argument, NULL, LO_TEXT_WRONG_COLOR},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
const char usage[] = const char usage[] =
"Usage: swaylock [options...]\n" "Usage: swaylock [options...]\n"
"\n" "\n"
" -h, --help Show help message and quit.\n" " -c, --color <color> "
" -c, --color <rrggbb[aa]> Turn the screen into the given color instead of white.\n" "Turn the screen into the given color instead of white.\n"
" -s, --scaling Scaling mode: stretch, fill, fit, center, tile.\n" " -e, --ignore-empty-password "
" -t, --tiling Same as --scaling=tile.\n" "When an empty password is provided, do not validate it.\n"
" -v, --version Show the version number and quit.\n" " -f, --daemonize "
" -i, --image [<output>:]<path> Display the given image.\n" "Detach from the controlling terminal after locking.\n"
" -u, --no-unlock-indicator Disable the unlock indicator.\n" " -h, --help "
" -f, --daemonize Detach from the controlling terminal after locking.\n"; "Show help message and quit.\n"
" -i, --image [<output>:]<path> "
"Display the given image.\n"
" -s, --scaling <mode> "
"Scaling mode: stretch, fill, fit, center, tile.\n"
" -t, --tiling "
"Same as --scaling=tile.\n"
" -u, --no-unlock-indicator "
"Disable the unlock indicator.\n"
" -v, --version "
"Show the version number and quit.\n"
" --bs-hl-color <color> "
"Sets the color of backspace highlight segments.\n"
" --font <font> "
"Sets the font of the text.\n"
" --indicator-radius <radius> "
"Sets the indicator radius.\n"
" --indicator-thickness <thick> "
"Sets the indicator thickness.\n"
" --inside-color <color> "
"Sets the color of the inside of the indicator.\n"
" --inside-clear-color <color> "
"Sets the color of the inside of the indicator when cleared.\n"
" --inside-ver-color <color> "
"Sets the color of the inside of the indicator when verifying.\n"
" --inside-wrong-color <color> "
"Sets the color of the inside of the indicator when invalid.\n"
" --key-hl-color <color> "
"Sets the color of the key press highlight segments.\n"
" --line-color <color> "
"Sets the color of the line between the inside and ring.\n"
" --line-clear-color <color> "
"Sets the color of the line between the inside and ring when "
"cleared.\n"
" --line-ver-color <color> "
"Sets the color of the line between the inside and ring when "
"verifying.\n"
" --line-wrong-color <color> "
"Sets the color of the line between the inside and ring when "
"invalid.\n"
" -n, --line-uses-inside "
"Use the inside color for the line between the inside and ring.\n"
" -r, --line-uses-ring "
"Use the ring color for the line between the inside and ring.\n"
" --ring-color <color> "
"Sets the color of the ring of the indicator.\n"
" --ring-clear-color <color> "
"Sets the color of the ring of the indicator when cleared.\n"
" --ring-ver-color <color> "
"Sets the color of the ring of the indicator when verifying.\n"
" --ring-wrong-color <color> "
"Sets the color of the ring of the indicator when invalid.\n"
" --separator-color <color> "
"Sets the color of the lines that separate highlight segments.\n"
" --text-color <color> "
"Sets the color of the text.\n"
" --text-clear-color <color> "
"Sets the color of the text when cleared.\n"
" --text-ver-color <color> "
"Sets the color of the text when verifying.\n"
" --text-wrong-color <color> "
"Sets the color of the text when invalid.\n"
"\n"
"All <color> options are of the form <rrggbb[aa]>.\n";
enum line_mode line_mode = LM_LINE;
state.args = (struct swaylock_args){ state.args = (struct swaylock_args){
.mode = BACKGROUND_MODE_SOLID_COLOR, .mode = BACKGROUND_MODE_SOLID_COLOR,
.color = 0xFFFFFFFF, .font = strdup("sans-serif"),
.radius = 50,
.thickness = 10,
.ignore_empty = false,
.show_indicator = true, .show_indicator = true,
}; };
wl_list_init(&state.images); wl_list_init(&state.images);
set_default_colors(&state.args.colors);
wlr_log_init(WLR_DEBUG, NULL); wlr_log_init(WLR_DEBUG, NULL);
int c; int c;
while (1) { while (1) {
int option_index = 0; int opt_idx = 0;
c = getopt_long(argc, argv, "hc:i:s:tvuf", long_options, &option_index); c = getopt_long(argc, argv, "c:efhi:nrs:tuv", long_options, &opt_idx);
if (c == -1) { if (c == -1) {
break; break;
} }
switch (c) { switch (c) {
case 'c': { case 'c':
state.args.color = parse_color(optarg); state.args.colors.background = parse_color(optarg);
state.args.mode = BACKGROUND_MODE_SOLID_COLOR; state.args.mode = BACKGROUND_MODE_SOLID_COLOR;
break; break;
} case 'e':
state.args.ignore_empty = true;
break;
case 'f':
state.args.daemonize = true;
break;
case 'i': case 'i':
load_image(optarg, &state); load_image(optarg, &state);
break; break;
case 'n':
line_mode = LM_INSIDE;
break;
case 'r':
line_mode = LM_RING;
break;
case 's': case 's':
state.args.mode = parse_background_mode(optarg); state.args.mode = parse_background_mode(optarg);
if (state.args.mode == BACKGROUND_MODE_INVALID) { if (state.args.mode == BACKGROUND_MODE_INVALID) {
@ -443,6 +609,9 @@ int main(int argc, char **argv) {
case 't': case 't':
state.args.mode = BACKGROUND_MODE_TILE; state.args.mode = BACKGROUND_MODE_TILE;
break; break;
case 'u':
state.args.show_indicator = false;
break;
case 'v': case 'v':
#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE #if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
fprintf(stdout, "swaylock version %s (%s, branch \"%s\")\n", fprintf(stdout, "swaylock version %s (%s, branch \"%s\")\n",
@ -451,11 +620,72 @@ int main(int argc, char **argv) {
fprintf(stdout, "version unknown\n"); fprintf(stdout, "version unknown\n");
#endif #endif
return 0; return 0;
case 'u': case LO_BS_HL_COLOR:
state.args.show_indicator = false; state.args.colors.bs_highlight = parse_color(optarg);
break; break;
case 'f': case LO_FONT:
state.args.daemonize = true; free(state.args.font);
state.args.font = strdup(optarg);
break;
case LO_IND_RADIUS:
state.args.radius = strtol(optarg, NULL, 0);
break;
case LO_IND_THICKNESS:
state.args.thickness = strtol(optarg, NULL, 0);
break;
case LO_INSIDE_COLOR:
state.args.colors.inside.input = parse_color(optarg);
break;
case LO_INSIDE_CLEAR_COLOR:
state.args.colors.inside.cleared = parse_color(optarg);
break;
case LO_INSIDE_VER_COLOR:
state.args.colors.inside.verifying = parse_color(optarg);
break;
case LO_INSIDE_WRONG_COLOR:
state.args.colors.inside.wrong = parse_color(optarg);
break;
case LO_KEY_HL_COLOR:
state.args.colors.key_highlight = parse_color(optarg);
break;
case LO_LINE_COLOR:
state.args.colors.line.input = parse_color(optarg);
break;
case LO_LINE_CLEAR_COLOR:
state.args.colors.line.cleared = parse_color(optarg);
break;
case LO_LINE_VER_COLOR:
state.args.colors.line.verifying = parse_color(optarg);
break;
case LO_LINE_WRONG_COLOR:
state.args.colors.line.wrong = parse_color(optarg);
break;
case LO_RING_COLOR:
state.args.colors.ring.input = parse_color(optarg);
break;
case LO_RING_CLEAR_COLOR:
state.args.colors.ring.cleared = parse_color(optarg);
break;
case LO_RING_VER_COLOR:
state.args.colors.ring.verifying = parse_color(optarg);
break;
case LO_RING_WRONG_COLOR:
state.args.colors.ring.wrong = parse_color(optarg);
break;
case LO_SEP_COLOR:
state.args.colors.separator = parse_color(optarg);
break;
case LO_TEXT_COLOR:
state.args.colors.text.input = parse_color(optarg);
break;
case LO_TEXT_CLEAR_COLOR:
state.args.colors.text.cleared = parse_color(optarg);
break;
case LO_TEXT_VER_COLOR:
state.args.colors.text.verifying = parse_color(optarg);
break;
case LO_TEXT_WRONG_COLOR:
state.args.colors.text.wrong = parse_color(optarg);
break; break;
default: default:
fprintf(stderr, "%s", usage); fprintf(stderr, "%s", usage);
@ -463,6 +693,12 @@ int main(int argc, char **argv) {
} }
} }
if (line_mode == LM_INSIDE) {
state.args.colors.line = state.args.colors.inside;
} else if (line_mode == LM_RING) {
state.args.colors.line = state.args.colors.ring;
}
#ifdef __linux__ #ifdef __linux__
// Most non-linux platforms require root to mlock() // Most non-linux platforms require root to mlock()
if (mlock(state.password.buffer, sizeof(state.password.buffer)) != 0) { if (mlock(state.password.buffer, sizeof(state.password.buffer)) != 0) {
@ -520,5 +756,7 @@ int main(int argc, char **argv) {
while (wl_display_dispatch(state.display) != -1 && state.run_display) { while (wl_display_dispatch(state.display) != -1 && state.run_display) {
// This space intentionally left blank // This space intentionally left blank
} }
free(state.args.font);
return 0; return 0;
} }

View file

@ -95,6 +95,10 @@ void swaylock_handle_key(struct swaylock_state *state,
switch (keysym) { switch (keysym) {
case XKB_KEY_KP_Enter: /* fallthrough */ case XKB_KEY_KP_Enter: /* fallthrough */
case XKB_KEY_Return: case XKB_KEY_Return:
if (state->args.ignore_empty && state->password.len == 0) {
break;
}
state->auth_state = AUTH_STATE_VALIDATING; state->auth_state = AUTH_STATE_VALIDATING;
damage_state(state); damage_state(state);
while (wl_display_dispatch(state->display) != -1 && state->run_display) { while (wl_display_dispatch(state->display) != -1 && state->run_display) {

View file

@ -7,11 +7,22 @@
#include "swaylock/swaylock.h" #include "swaylock/swaylock.h"
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
const int ARC_RADIUS = 50;
const int ARC_THICKNESS = 10;
const float TYPE_INDICATOR_RANGE = M_PI / 3.0f; const float TYPE_INDICATOR_RANGE = M_PI / 3.0f;
const float TYPE_INDICATOR_BORDER_THICKNESS = M_PI / 128.0f; const float TYPE_INDICATOR_BORDER_THICKNESS = M_PI / 128.0f;
static void set_color_for_state(cairo_t *cairo, struct swaylock_state *state,
struct swaylock_colorset *colorset) {
if (state->auth_state == AUTH_STATE_VALIDATING) {
cairo_set_source_u32(cairo, colorset->verifying);
} else if (state->auth_state == AUTH_STATE_INVALID) {
cairo_set_source_u32(cairo, colorset->wrong);
} else if (state->auth_state == AUTH_STATE_CLEAR) {
cairo_set_source_u32(cairo, colorset->cleared);
} else {
cairo_set_source_u32(cairo, colorset->input);
}
}
void render_frame(struct swaylock_surface *surface) { void render_frame(struct swaylock_surface *surface) {
struct swaylock_state *state = surface->state; struct swaylock_state *state = surface->state;
@ -33,7 +44,7 @@ void render_frame(struct swaylock_surface *surface) {
cairo_save(cairo); cairo_save(cairo);
cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE); cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
if (state->args.mode == BACKGROUND_MODE_SOLID_COLOR || !surface->image) { if (state->args.mode == BACKGROUND_MODE_SOLID_COLOR || !surface->image) {
cairo_set_source_u32(cairo, state->args.color); cairo_set_source_u32(cairo, state->args.colors.background);
cairo_paint(cairo); cairo_paint(cairo);
} else { } else {
render_background_image(cairo, surface->image, render_background_image(cairo, surface->image,
@ -42,49 +53,25 @@ void render_frame(struct swaylock_surface *surface) {
cairo_restore(cairo); cairo_restore(cairo);
cairo_identity_matrix(cairo); cairo_identity_matrix(cairo);
int arc_radius = ARC_RADIUS * surface->scale; int arc_radius = state->args.radius * surface->scale;
int arc_thickness = ARC_THICKNESS * surface->scale; int arc_thickness = state->args.thickness * surface->scale;
float type_indicator_border_thickness = float type_indicator_border_thickness =
TYPE_INDICATOR_BORDER_THICKNESS * surface->scale; TYPE_INDICATOR_BORDER_THICKNESS * surface->scale;
if (state->args.show_indicator && state->auth_state != AUTH_STATE_IDLE) { if (state->args.show_indicator && state->auth_state != AUTH_STATE_IDLE) {
// Draw circle // Draw circle
cairo_set_line_width(cairo, arc_thickness); cairo_set_line_width(cairo, arc_thickness);
cairo_arc(cairo, buffer_width / 2, buffer_height / 2, arc_radius, 0, 2 * M_PI); cairo_arc(cairo, buffer_width / 2, buffer_height / 2, arc_radius,
switch (state->auth_state) { 0, 2 * M_PI);
case AUTH_STATE_INPUT: set_color_for_state(cairo, state, &state->args.colors.inside);
case AUTH_STATE_INPUT_NOP:
case AUTH_STATE_BACKSPACE: {
cairo_set_source_rgba(cairo, 0, 0, 0, 0.75);
cairo_fill_preserve(cairo); cairo_fill_preserve(cairo);
cairo_set_source_rgb(cairo, 51.0 / 255, 125.0 / 255, 0); set_color_for_state(cairo, state, &state->args.colors.ring);
cairo_stroke(cairo); cairo_stroke(cairo);
} break;
case AUTH_STATE_VALIDATING: {
cairo_set_source_rgba(cairo, 0, 114.0 / 255, 255.0 / 255, 0.75);
cairo_fill_preserve(cairo);
cairo_set_source_rgb(cairo, 51.0 / 255, 0, 250.0 / 255);
cairo_stroke(cairo);
} break;
case AUTH_STATE_INVALID: {
cairo_set_source_rgba(cairo, 250.0 / 255, 0, 0, 0.75);
cairo_fill_preserve(cairo);
cairo_set_source_rgb(cairo, 125.0 / 255, 51.0 / 255, 0);
cairo_stroke(cairo);
} break;
case AUTH_STATE_CLEAR: {
cairo_set_source_rgba(cairo, 229.0/255, 164.0/255, 69.0/255, 0.75);
cairo_fill_preserve(cairo);
cairo_set_source_rgb(cairo, 229.0/255, 164.0/255, 69.0/255);
cairo_stroke(cairo);
} break;
default: break;
}
// Draw a message // Draw a message
char *text = NULL; char *text = NULL;
cairo_set_source_rgb(cairo, 0, 0, 0); set_color_for_state(cairo, state, &state->args.colors.text);
cairo_select_font_face(cairo, "sans-serif", cairo_select_font_face(cairo, state->args.font,
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(cairo, arc_radius / 3.0f); cairo_set_font_size(cairo, arc_radius / 3.0f);
switch (state->auth_state) { switch (state->auth_state) {
@ -101,9 +88,10 @@ void render_frame(struct swaylock_surface *surface) {
case AUTH_STATE_INPUT_NOP: case AUTH_STATE_INPUT_NOP:
if (state->xkb.caps_lock) { if (state->xkb.caps_lock) {
text = "Caps Lock"; text = "Caps Lock";
cairo_set_source_rgb(cairo, 229.0/255, 164.0/255, 69.0/255);
} }
default: break; break;
default:
break;
} }
if (text) { if (text) {
@ -131,14 +119,14 @@ void render_frame(struct swaylock_surface *surface) {
arc_radius, highlight_start, arc_radius, highlight_start,
highlight_start + TYPE_INDICATOR_RANGE); highlight_start + TYPE_INDICATOR_RANGE);
if (state->auth_state == AUTH_STATE_INPUT) { if (state->auth_state == AUTH_STATE_INPUT) {
cairo_set_source_rgb(cairo, 51.0 / 255, 219.0 / 255, 0); cairo_set_source_u32(cairo, state->args.colors.key_highlight);
} else { } else {
cairo_set_source_rgb(cairo, 219.0 / 255, 51.0 / 255, 0); cairo_set_source_u32(cairo, state->args.colors.bs_highlight);
} }
cairo_stroke(cairo); cairo_stroke(cairo);
// Draw borders // Draw borders
cairo_set_source_rgb(cairo, 0, 0, 0); cairo_set_source_u32(cairo, state->args.colors.separator);
cairo_arc(cairo, buffer_width / 2, buffer_height / 2, cairo_arc(cairo, buffer_width / 2, buffer_height / 2,
arc_radius, highlight_start, arc_radius, highlight_start,
highlight_start + type_indicator_border_thickness); highlight_start + type_indicator_border_thickness);
@ -152,7 +140,7 @@ void render_frame(struct swaylock_surface *surface) {
} }
// Draw inner + outer border of the circle // Draw inner + outer border of the circle
cairo_set_source_rgb(cairo, 0, 0, 0); set_color_for_state(cairo, state, &state->args.colors.line);
cairo_set_line_width(cairo, 2.0 * surface->scale); cairo_set_line_width(cairo, 2.0 * surface->scale);
cairo_arc(cairo, buffer_width / 2, buffer_height / 2, cairo_arc(cairo, buffer_width / 2, buffer_height / 2,
arc_radius - arc_thickness / 2, 0, 2 * M_PI); arc_radius - arc_thickness / 2, 0, 2 * M_PI);

View file

@ -12,23 +12,25 @@ Locks your Wayland session.
# OPTIONS # OPTIONS
*-h, --help*
Show help message and quit.
*-c, --color* <rrggbb[aa]> *-c, --color* <rrggbb[aa]>
Turn the screen into the given color. If -i is used, this sets the Turn the screen into the given color. If -i is used, this sets the
background of the image to the given color. Defaults to white (FFFFFF), or background of the image to the given color. Defaults to white (FFFFFF), or
transparent (00000000) if an image is in use. transparent (00000000) if an image is in use.
*-e, --ignore-empty-password*
When an empty password is provided by the user, do not validate it.
*-f, --daemonize* *-f, --daemonize*
Fork into the background after spawning. Note: this is the default behavior Detach from the controlling terminal after locking.
of i3lock.
*-h, --help*
Show help message and quit.
*-i, --image* [<output>:]<path> *-i, --image* [<output>:]<path>
Display the given image, optionally only on the given output. Use -c to set Display the given image, optionally only on the given output. Use -c to set
a background color. a background color.
*--scaling* *-s, --scaling*
Scaling mode for images: _stretch_, _fill_, _fit_, _center_, or _tile_. Scaling mode for images: _stretch_, _fill_, _fit_, _center_, or _tile_.
*-t, --tiling* *-t, --tiling*
@ -37,59 +39,17 @@ Locks your Wayland session.
*-u, --no-unlock-indicator* *-u, --no-unlock-indicator*
Disable the unlock indicator. Disable the unlock indicator.
*-f, --daemonize*
Detach from the controlling terminal after locking.
*-v, --version* *-v, --version*
Show the version number and quit. Show the version number and quit.
# APPEARANCE # APPEARANCE
*--bshlcolor* <rrggbb[aa]> *--bs-hl-color* <rrggbb[aa]>
Sets the color of backspace highlight segments. Sets the color of backspace highlight segments.
*--font* <font> *--font* <font>
Sets the font of the text inside the indicator. Sets the font of the text inside the indicator.
*--insidecolor* <rrggbb[aa]>
Sets the color of the inside of the indicator when typing or idle.
*--insidevercolor* <rrggbb[aa]>
Sets the color of the inside of the indicator when verifying.
*--insidewrongcolor* <rrggbb[aa]>
Sets the color of the inside of the indicator when invalid.
*--keyhlcolor* <rrggbb[aa]>
Sets the color of keypress highlight segments.
*--linecolor* <rrggbb[aa]>
Sets the color of the lines that separate the inside and outside of the
indicator.
*-s, --line-uses-inside*
Use the color of the inside of the indicator for the line separating the
inside and outside of the indicator.
*-r, --line-uses-ring*
Use the outer ring's color for the line separating the inside and outside of
the indicator.
*--ringcolor* <rrggbb[aa]>
Sets the color of the outside of the indicator when typing or idle.
*--ringvercolor* <rrggbb[aa]>
Sets the color of the outside of the indicator when verifying.
*--ringwrongcolor* <rrggbb[aa]>
Sets the color of the outside of the indicator when invalid.
*--separatorcolor* <rrggbb[aa]>
Sets the color of the lines that seperate highlight segments.
*--textcolor* <rrggbb[aa]>
Sets the color of the text inside the indicator.
*--indicator-radius* <radius> *--indicator-radius* <radius>
Sets the radius of the indicator to _radius_ pixels. The default value is Sets the radius of the indicator to _radius_ pixels. The default value is
50. 50.
@ -98,6 +58,72 @@ Locks your Wayland session.
Sets the thickness of the indicator to _thickness_ pixels. The default value Sets the thickness of the indicator to _thickness_ pixels. The default value
is 10. is 10.
*--inside-color* <rrggbb[aa]>
Sets the color of the inside of the indicator when typing or idle.
*--inside-clear-color* <rrggbb[aa]>
Sets the color of the inside of the indicator when cleared.
*--inside-ver-color* <rrggbb[aa]>
Sets the color of the inside of the indicator when verifying.
*--inside-wrong-color* <rrggbb[aa]>
Sets the color of the inside of the indicator when invalid.
*--key-hl-color* <rrggbb[aa]>
Sets the color of key press highlight segments.
*--line-color* <rrggbb[aa]>
Sets the color of the lines that separate the inside and outside of the
indicator when typing or idle.
*--line-clear-color* <rrggbb[aa]>
Sets the color of the lines that separate the inside and outside of the
indicator when cleared.
*--line-ver-color* <rrggbb[aa]>
Sets the color of the lines that separate the inside and outside of the
indicator when verifying.
*--line-wrong-color* <rrggbb[aa]>
Sets the color of the lines that separate the inside and outside of the
indicator when invalid.
*-n, --line-uses-inside*
Use the color of the inside of the indicator for the line separating the
inside and outside of the indicator.
*-r, --line-uses-ring*
Use the outer ring's color for the line separating the inside and outside of
the indicator.
*--ring-color* <rrggbb[aa]>
Sets the color of the outside of the indicator when typing or idle.
*--ring-clear-color* <rrggbb[aa]>
Sets the color of the outside of the indicator when cleared.
*--ring-ver-color* <rrggbb[aa]>
Sets the color of the outside of the indicator when verifying.
*--ring-wrong-color* <rrggbb[aa]>
Sets the color of the outside of the indicator when invalid.
*--separator-color* <rrggbb[aa]>
Sets the color of the lines that separate highlight segments.
*--text-color* <rrggbb[aa]>
Sets the color of the text inside the indicator when typing or idle.
*--text-clear-color* <rrggbb[aa]>
Sets the color of the text inside the indicator when cleared.
*--text-ver-color* <rrggbb[aa]>
Sets the color of the text inside the indicator when verifying.
*--text-wrong-color* <rrggbb[aa]>
Sets the color of the text inside the indicator when invalid.
# AUTHORS # AUTHORS
Maintained by Drew DeVault <sir@cmpwn.com>, who is assisted by other open Maintained by Drew DeVault <sir@cmpwn.com>, who is assisted by other open