diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-06-01 08:50:36 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-06-01 08:50:36 -0400 |
commit | df16c2e7d17ca6750b942d356d5ea3c47aa0efee (patch) | |
tree | 11985edc000a2c2a57f5268ff025e9db318d0d66 | |
parent | 4d6be1b6404a1c1bbb75d0862eee28412fffc1ef (diff) | |
parent | 009eaccd421cf0640cdebc3bac96d67c599ff616 (diff) |
Merge pull request #689 from thuck/floating_size_conf
Floating size conf
-rw-r--r-- | include/config.h | 2 | ||||
-rw-r--r-- | sway/commands.c | 36 | ||||
-rw-r--r-- | sway/sway.5.txt | 5 |
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 { uint32_t background; } border_colors; - // floating view minimum + // floating view int32_t floating_maximum_width; int32_t floating_maximum_height; 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; static sway_cmd cmd_exec_always; static sway_cmd cmd_exit; static sway_cmd cmd_floating; +static sway_cmd cmd_floating_minimum_size; static sway_cmd cmd_floating_mod; static sway_cmd cmd_floating_scroll; static sway_cmd cmd_focus; @@ -673,6 +674,40 @@ static struct cmd_results *cmd_floating(int argc, char **argv) { return cmd_results_new(CMD_SUCCESS, NULL, NULL); } +static struct cmd_results *cmd_floating_minimum_size(int argc, char **argv) { + struct cmd_results *error = NULL; + int32_t width; + int32_t height; + char *ptr; + + if ((error = checkarg(argc, "floating_minimum_size", EXPECTED_EQUAL_TO, 3))) { + return error; + } + width = strtol(argv[0], &ptr, 10); + height = strtol(argv[2], &ptr, 10); + + if (width <= 0) { + sway_log(L_DEBUG, "floating_minimum_size invalid width value: '%s'", argv[0]); + + } else { + config->floating_minimum_width = width; + + } + + if (height <= 0) { + sway_log(L_DEBUG, "floating_minimum_size invalid height value: '%s'", argv[2]); + } + else { + config->floating_minimum_height = height; + + } + + sway_log(L_DEBUG, "New floating_minimum_size: '%d' x '%d'", config->floating_minimum_width, + config->floating_minimum_height); + + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} + static struct cmd_results *cmd_floating_mod(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "floating_modifier", EXPECTED_AT_LEAST, 1))) { @@ -2433,6 +2468,7 @@ static struct cmd_handler handlers[] = { { "exec_always", cmd_exec_always }, { "exit", cmd_exit }, { "floating", cmd_floating }, + { "floating_minimum_size", cmd_floating_minimum_size }, { "floating_modifier", cmd_floating_mod }, { "floating_scroll", cmd_floating_scroll }, { "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**( **floating** <enable|disable|toggle>:: Make focused view floating, non-floating, or the opposite of what it is now. +**floating_minimum_size** <width> x <height>:: + Specifies the minimum dimensions of floating windows. + Default parameters are 75 x 50. + -1 and 0 are invalid parameters, default will be used instead. + **focus** <direction>:: Direction may be one of _up_, _down_, _left_, _right_, or _parent_. The directional focus commands will move the focus in that direction. The parent |