diff options
-rw-r--r-- | include/config.h | 3 | ||||
-rw-r--r-- | sway/commands.c | 36 | ||||
-rw-r--r-- | sway/config.c | 2 |
3 files changed, 40 insertions, 1 deletions
diff --git a/include/config.h b/include/config.h index 1a6ba19d..9e59cb66 100644 --- a/include/config.h +++ b/include/config.h | |||
@@ -227,11 +227,12 @@ struct sway_config { | |||
227 | uint32_t background; | 227 | uint32_t background; |
228 | } border_colors; | 228 | } border_colors; |
229 | 229 | ||
230 | // floating view minimum | 230 | // floating view |
231 | int32_t floating_maximum_width; | 231 | int32_t floating_maximum_width; |
232 | int32_t floating_maximum_height; | 232 | int32_t floating_maximum_height; |
233 | int32_t floating_minimum_width; | 233 | int32_t floating_minimum_width; |
234 | int32_t floating_minimum_height; | 234 | int32_t floating_minimum_height; |
235 | char *floating_minimum_size; | ||
235 | }; | 236 | }; |
236 | 237 | ||
237 | /** | 238 | /** |
diff --git a/sway/commands.c b/sway/commands.c index 62852980..d8f61242 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -58,6 +58,7 @@ static sway_cmd cmd_exec; | |||
58 | static sway_cmd cmd_exec_always; | 58 | static sway_cmd cmd_exec_always; |
59 | static sway_cmd cmd_exit; | 59 | static sway_cmd cmd_exit; |
60 | static sway_cmd cmd_floating; | 60 | static sway_cmd cmd_floating; |
61 | static sway_cmd cmd_floating_minimum_size; | ||
61 | static sway_cmd cmd_floating_mod; | 62 | static sway_cmd cmd_floating_mod; |
62 | static sway_cmd cmd_floating_scroll; | 63 | static sway_cmd cmd_floating_scroll; |
63 | static sway_cmd cmd_focus; | 64 | static sway_cmd cmd_focus; |
@@ -673,6 +674,40 @@ static struct cmd_results *cmd_floating(int argc, char **argv) { | |||
673 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 674 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
674 | } | 675 | } |
675 | 676 | ||
677 | static struct cmd_results *cmd_floating_minimum_size(int argc, char **argv) { | ||
678 | struct cmd_results *error = NULL; | ||
679 | int32_t width; | ||
680 | int32_t height; | ||
681 | char *ptr; | ||
682 | |||
683 | if ((error = checkarg(argc, "floating_minimum_size", EXPECTED_EQUAL_TO, 3))) { | ||
684 | return error; | ||
685 | } | ||
686 | width = strtol(argv[0], &ptr, 10); | ||
687 | height = strtol(argv[2], &ptr, 10); | ||
688 | |||
689 | if (width <= 0) { | ||
690 | sway_log(L_DEBUG, "floating_minimum_size invalid width value: '%s'", argv[0]); | ||
691 | |||
692 | } else { | ||
693 | config->floating_minimum_width = width; | ||
694 | |||
695 | } | ||
696 | |||
697 | if (height <= 0) { | ||
698 | sway_log(L_DEBUG, "floating_minimum_size invalid height value: '%s'", argv[2]); | ||
699 | } | ||
700 | else { | ||
701 | config->floating_minimum_height = height; | ||
702 | |||
703 | } | ||
704 | |||
705 | sway_log(L_DEBUG, "New floating_minimum_size: '%d' x '%d'", config->floating_minimum_width, | ||
706 | config->floating_minimum_height); | ||
707 | |||
708 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
709 | } | ||
710 | |||
676 | static struct cmd_results *cmd_floating_mod(int argc, char **argv) { | 711 | static struct cmd_results *cmd_floating_mod(int argc, char **argv) { |
677 | struct cmd_results *error = NULL; | 712 | struct cmd_results *error = NULL; |
678 | if ((error = checkarg(argc, "floating_modifier", EXPECTED_AT_LEAST, 1))) { | 713 | if ((error = checkarg(argc, "floating_modifier", EXPECTED_AT_LEAST, 1))) { |
@@ -2433,6 +2468,7 @@ static struct cmd_handler handlers[] = { | |||
2433 | { "exec_always", cmd_exec_always }, | 2468 | { "exec_always", cmd_exec_always }, |
2434 | { "exit", cmd_exit }, | 2469 | { "exit", cmd_exit }, |
2435 | { "floating", cmd_floating }, | 2470 | { "floating", cmd_floating }, |
2471 | { "floating_minimum_size", cmd_floating_minimum_size }, | ||
2436 | { "floating_modifier", cmd_floating_mod }, | 2472 | { "floating_modifier", cmd_floating_mod }, |
2437 | { "floating_scroll", cmd_floating_scroll }, | 2473 | { "floating_scroll", cmd_floating_scroll }, |
2438 | { "focus", cmd_focus }, | 2474 | { "focus", cmd_focus }, |
diff --git a/sway/config.c b/sway/config.c index 95285eba..b4e740f6 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -178,6 +178,8 @@ static void config_defaults(struct sway_config *config) { | |||
178 | config->floating_minimum_width = 75; | 178 | config->floating_minimum_width = 75; |
179 | config->floating_minimum_height = 50; | 179 | config->floating_minimum_height = 50; |
180 | 180 | ||
181 | config->floating_minimum_size = strdup(""); | ||
182 | |||
181 | // Flags | 183 | // Flags |
182 | config->focus_follows_mouse = true; | 184 | config->focus_follows_mouse = true; |
183 | config->mouse_warping = true; | 185 | config->mouse_warping = true; |