diff options
author | Denis Doria <denisdoria@gmail.com> | 2016-06-01 13:37:50 +0200 |
---|---|---|
committer | Denis Doria <denisdoria@gmail.com> | 2016-06-01 13:37:50 +0200 |
commit | 0ad7857f909278fde8603b995d59b86437d5247f (patch) | |
tree | 25364b13d60ef443fc09f66d3886c477c46868b6 /sway | |
parent | Merge pull request #686 from zandrmartin/fix-swaybar-in-08bef67 (diff) | |
download | sway-0ad7857f909278fde8603b995d59b86437d5247f.tar.gz sway-0ad7857f909278fde8603b995d59b86437d5247f.tar.zst sway-0ad7857f909278fde8603b995d59b86437d5247f.zip |
Included option floating_minimum_size
Values cannot be negative or 0; if so uses the default 75x50.
Uses the same syntax as i3: floating_minimum_size <width> x <height>, although the x can be anything.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 36 | ||||
-rw-r--r-- | sway/config.c | 2 |
2 files changed, 38 insertions, 0 deletions
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; |