From 183d1bd54926b061a8e81585944b80fb9ab0f619 Mon Sep 17 00:00:00 2001 From: Peter Kasza Date: Sun, 5 May 2019 11:29:44 +0200 Subject: Add fixed font-size option for indicator This commit adds a new command line option called --font-size to specify a fixed font size in the indicator. The default value for font-size is 0, which means that the text will autoscale. Any other positive value will result in a fixed text size. --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 63ba56c..684fc37 100644 --- a/main.c +++ b/main.c @@ -504,6 +504,7 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state, LO_CAPS_LOCK_BS_HL_COLOR, LO_CAPS_LOCK_KEY_HL_COLOR, LO_FONT, + LO_FONT_SIZE, LO_IND_RADIUS, LO_IND_THICKNESS, LO_INSIDE_COLOR, @@ -557,6 +558,7 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state, {"caps-lock-bs-hl-color", required_argument, NULL, LO_CAPS_LOCK_BS_HL_COLOR}, {"caps-lock-key-hl-color", required_argument, NULL, LO_CAPS_LOCK_KEY_HL_COLOR}, {"font", required_argument, NULL, LO_FONT}, + {"font-size", required_argument, NULL, LO_FONT_SIZE}, {"indicator-radius", required_argument, NULL, LO_IND_RADIUS}, {"indicator-thickness", required_argument, NULL, LO_IND_THICKNESS}, {"inside-color", required_argument, NULL, LO_INSIDE_COLOR}, @@ -632,6 +634,8 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state, "Caps Lock is active.\n" " --font " "Sets the font of the text.\n" + " --font-size " + "Sets a fixed font size for the indicator text.\n" " --indicator-radius " "Sets the indicator radius.\n" " --indicator-thickness " @@ -815,6 +819,11 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state, state->args.font = strdup(optarg); } break; + case LO_FONT_SIZE: + if (state) { + state->args.font_size = atoi(optarg); + } + break; case LO_IND_RADIUS: if (state) { state->args.radius = strtol(optarg, NULL, 0); @@ -1064,6 +1073,7 @@ int main(int argc, char **argv) { state.args = (struct swaylock_args){ .mode = BACKGROUND_MODE_FILL, .font = strdup("sans-serif"), + .font_size = 0, .radius = 50, .thickness = 10, .ignore_empty = false, -- cgit v1.2.3