aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-06-01 08:50:36 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-06-01 08:50:36 -0400
commitdf16c2e7d17ca6750b942d356d5ea3c47aa0efee (patch)
tree11985edc000a2c2a57f5268ff025e9db318d0d66
parentMerge pull request #686 from zandrmartin/fix-swaybar-in-08bef67 (diff)
parentClean up not used variables (diff)
downloadsway-df16c2e7d17ca6750b942d356d5ea3c47aa0efee.tar.gz
sway-df16c2e7d17ca6750b942d356d5ea3c47aa0efee.tar.zst
sway-df16c2e7d17ca6750b942d356d5ea3c47aa0efee.zip
Merge pull request #689 from thuck/floating_size_conf
Floating size conf
-rw-r--r--include/config.h2
-rw-r--r--sway/commands.c36
-rw-r--r--sway/sway.5.txt5
3 files changed, 42 insertions, 1 deletions
diff --git a/include/config.h b/include/config.h
index 1a6ba19d..d591daf2 100644
--- a/include/config.h
+++ b/include/config.h
@@ -227,7 +227,7 @@ 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;
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;
58static sway_cmd cmd_exec_always; 58static sway_cmd cmd_exec_always;
59static sway_cmd cmd_exit; 59static sway_cmd cmd_exit;
60static sway_cmd cmd_floating; 60static sway_cmd cmd_floating;
61static sway_cmd cmd_floating_minimum_size;
61static sway_cmd cmd_floating_mod; 62static sway_cmd cmd_floating_mod;
62static sway_cmd cmd_floating_scroll; 63static sway_cmd cmd_floating_scroll;
63static sway_cmd cmd_focus; 64static 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
677static 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
676static struct cmd_results *cmd_floating_mod(int argc, char **argv) { 711static 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/sway.5.txt b/sway/sway.5.txt
index 32ff79d8..1afcf24f 100644
--- a/sway/sway.5.txt
+++ b/sway/sway.5.txt
@@ -65,6 +65,11 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**(
65**floating** <enable|disable|toggle>:: 65**floating** <enable|disable|toggle>::
66 Make focused view floating, non-floating, or the opposite of what it is now. 66 Make focused view floating, non-floating, or the opposite of what it is now.
67 67
68**floating_minimum_size** <width> x <height>::
69 Specifies the minimum dimensions of floating windows.
70 Default parameters are 75 x 50.
71 -1 and 0 are invalid parameters, default will be used instead.
72
68**focus** <direction>:: 73**focus** <direction>::
69 Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The 74 Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The
70 directional focus commands will move the focus in that direction. The parent 75 directional focus commands will move the focus in that direction. The parent