summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPeter Kasza <peter.kasza@itinsight.hu>2019-05-05 11:29:44 +0200
committerDrew DeVault <sir@cmpwn.com>2019-05-05 09:25:59 -0600
commit183d1bd54926b061a8e81585944b80fb9ab0f619 (patch)
tree4d4a740ca4e69c6670f3a8a0e3726b68a0c1d1f0 /main.c
parent84bfc6c7edf1465096f6663c6d931981bd924280 (diff)
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.
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 10 insertions, 0 deletions
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 <font> "
"Sets the font of the text.\n"
+ " --font-size <size> "
+ "Sets a fixed font size for the indicator text.\n"
" --indicator-radius <radius> "
"Sets the indicator radius.\n"
" --indicator-thickness <thick> "
@@ -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,