From a7404e109643bffb77cb63b6f22fc5d46a7cead2 Mon Sep 17 00:00:00 2001 From: Matt Della Date: Wed, 27 Nov 2019 16:43:16 -0800 Subject: Added option to adjust ring position via CLI arguments and the config file --- main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index e110f08..c65d68a 100644 --- a/main.c +++ b/main.c @@ -509,6 +509,8 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state, LO_FONT_SIZE, LO_IND_IDLE_VISIBLE, LO_IND_RADIUS, + LO_IND_X_POSITION, + LO_IND_Y_POSITION, LO_IND_THICKNESS, LO_INSIDE_COLOR, LO_INSIDE_CLEAR_COLOR, @@ -564,6 +566,8 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state, {"indicator-idle-visible", no_argument, NULL, LO_IND_IDLE_VISIBLE}, {"indicator-radius", required_argument, NULL, LO_IND_RADIUS}, {"indicator-thickness", required_argument, NULL, LO_IND_THICKNESS}, + {"indicator-x-position", required_argument, NULL, LO_IND_X_POSITION}, + {"indicator-y-position", required_argument, NULL, LO_IND_Y_POSITION}, {"inside-color", required_argument, NULL, LO_INSIDE_COLOR}, {"inside-clear-color", required_argument, NULL, LO_INSIDE_CLEAR_COLOR}, {"inside-caps-lock-color", required_argument, NULL, LO_INSIDE_CAPS_LOCK_COLOR}, @@ -645,6 +649,10 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state, "Sets the indicator radius.\n" " --indicator-thickness " "Sets the indicator thickness.\n" + " --indicator-x-position " + "Sets the horizontal position of the indicator.\n" + " --indicator-y-position " + "Sets the vertical position of the indicator.\n" " --inside-color " "Sets the color of the inside of the indicator.\n" " --inside-clear-color " @@ -844,6 +852,18 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state, state->args.thickness = strtol(optarg, NULL, 0); } break; + case LO_IND_X_POSITION: + if (state) { + state->args.override_indicator_x_position = true; + state->args.indicator_x_position = atoi(optarg); + } + break; + case LO_IND_Y_POSITION: + if (state) { + state->args.override_indicator_y_position = true; + state->args.indicator_y_position = atoi(optarg); + } + break; case LO_INSIDE_COLOR: if (state) { state->args.colors.inside.input = parse_color(optarg); @@ -1087,6 +1107,10 @@ int main(int argc, char **argv) { .font_size = 0, .radius = 50, .thickness = 10, + .indicator_x_position = 0, + .indicator_y_position = 0, + .override_indicator_x_position = false, + .override_indicator_y_position = false, .ignore_empty = false, .show_indicator = true, .show_caps_lock_indicator = false, -- cgit v1.2.3