mirror of
https://github.com/swaywm/sway.git
synced 2024-11-18 22:19:14 +00:00
commit
713c7d6e1e
|
@ -69,18 +69,18 @@ Commands
|
||||||
Toggles fullscreen status for the focused view.
|
Toggles fullscreen status for the focused view.
|
||||||
|
|
||||||
**gaps** <amount>::
|
**gaps** <amount>::
|
||||||
Sets _amount_ pixels as the gap between each view, and around each
|
Sets default _amount_ pixels as the gap between each view, and around each
|
||||||
workspace.
|
workspace.
|
||||||
|
|
||||||
**gaps** <inner|outer> <amount>::
|
**gaps** <inner|outer> <amount>::
|
||||||
Sets _amount_ pixels as the _inner_ or _outer_ gap, where the former affects
|
Sets default _amount_ pixels as the _inner_ or _outer_ gap, where the former
|
||||||
spacing between views and the latter affects the space around each
|
affects spacing between views and the latter affects the space around each
|
||||||
workspace.
|
workspace.
|
||||||
|
|
||||||
**gaps** <inner|outer> <all|workspace|current> <set|plus|minus> <amount>::
|
**gaps** <inner|outer> <all|workspace|current> <set|plus|minus> <amount>::
|
||||||
Changes the gaps for the _inner_ or _outer_ gap. _all_ changes the gaps for
|
Changes the gaps for the _inner_ or _outer_ gap. _all_ changes the gaps for
|
||||||
all views or workspace, _workspace_ changes gaps for all views in current
|
all views or workspace, _workspace_ changes gaps for all views in current
|
||||||
workspace, or current workspace, and _current_ changes gaps for the current
|
workspace (or current workspace), and _current_ changes gaps for the current
|
||||||
view or workspace.
|
view or workspace.
|
||||||
|
|
||||||
**kill**::
|
**kill**::
|
||||||
|
|
|
@ -760,26 +760,24 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
|
||||||
if ((error = checkarg(argc, "gaps", EXPECTED_AT_LEAST, 1))) {
|
if ((error = checkarg(argc, "gaps", EXPECTED_AT_LEAST, 1))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
const char* expected_syntax =
|
||||||
|
"Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'";
|
||||||
const char *amount_str = argv[0];
|
const char *amount_str = argv[0];
|
||||||
// gaps amount
|
// gaps amount
|
||||||
if (argc >= 1 && isdigit(*amount_str)) {
|
if (argc >= 1 && isdigit(*amount_str)) {
|
||||||
int amount = (int)strtol(amount_str, NULL, 10);
|
int amount = (int)strtol(amount_str, NULL, 10);
|
||||||
if (errno == ERANGE || amount == 0) {
|
if (errno == ERANGE) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return cmd_results_new(CMD_INVALID, "gaps", "Number is out out of range.");
|
return cmd_results_new(CMD_INVALID, "gaps", "Number is out out of range.");
|
||||||
}
|
}
|
||||||
if (config->gaps_inner == 0) {
|
config->gaps_inner = config->gaps_outer = amount;
|
||||||
config->gaps_inner = amount;
|
arrange_windows(&root_container, -1, -1);
|
||||||
}
|
|
||||||
if (config->gaps_outer == 0) {
|
|
||||||
config->gaps_outer = amount;
|
|
||||||
}
|
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||||
}
|
}
|
||||||
// gaps inner|outer n
|
// gaps inner|outer n
|
||||||
else if (argc >= 2 && isdigit((amount_str = argv[1])[0])) {
|
else if (argc >= 2 && isdigit((amount_str = argv[1])[0])) {
|
||||||
int amount = (int)strtol(amount_str, NULL, 10);
|
int amount = (int)strtol(amount_str, NULL, 10);
|
||||||
if (errno == ERANGE || amount == 0) {
|
if (errno == ERANGE) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return cmd_results_new(CMD_INVALID, "gaps", "Number is out out of range.");
|
return cmd_results_new(CMD_INVALID, "gaps", "Number is out out of range.");
|
||||||
}
|
}
|
||||||
|
@ -789,11 +787,12 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
|
||||||
} else if (strcasecmp(target_str, "outer") == 0) {
|
} else if (strcasecmp(target_str, "outer") == 0) {
|
||||||
config->gaps_outer = amount;
|
config->gaps_outer = amount;
|
||||||
}
|
}
|
||||||
|
arrange_windows(&root_container, -1, -1);
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||||
}
|
}
|
||||||
// gaps inner|outer current|all set|plus|minus n
|
// gaps inner|outer current|all set|plus|minus n
|
||||||
if (argc < 4 || config->reading) {
|
if (argc < 4 || config->reading) {
|
||||||
return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'");
|
return cmd_results_new(CMD_INVALID, "gaps", expected_syntax);
|
||||||
}
|
}
|
||||||
// gaps inner|outer ...
|
// gaps inner|outer ...
|
||||||
const char *inout_str = argv[0];
|
const char *inout_str = argv[0];
|
||||||
|
@ -803,7 +802,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
|
||||||
} else if (strcasecmp(inout_str, "outer") == 0) {
|
} else if (strcasecmp(inout_str, "outer") == 0) {
|
||||||
inout = OUTER;
|
inout = OUTER;
|
||||||
} else {
|
} else {
|
||||||
return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'");
|
return cmd_results_new(CMD_INVALID, "gaps", expected_syntax);
|
||||||
}
|
}
|
||||||
|
|
||||||
// gaps ... current|all ...
|
// gaps ... current|all ...
|
||||||
|
@ -821,13 +820,13 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
|
||||||
target = WORKSPACE;
|
target = WORKSPACE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'");
|
return cmd_results_new(CMD_INVALID, "gaps", expected_syntax);
|
||||||
}
|
}
|
||||||
|
|
||||||
// gaps ... n
|
// gaps ... n
|
||||||
amount_str = argv[3];
|
amount_str = argv[3];
|
||||||
int amount = (int)strtol(amount_str, NULL, 10);
|
int amount = (int)strtol(amount_str, NULL, 10);
|
||||||
if (errno == ERANGE || amount == 0) {
|
if (errno == ERANGE) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return cmd_results_new(CMD_INVALID, "gaps", "Number is out out of range.");
|
return cmd_results_new(CMD_INVALID, "gaps", "Number is out out of range.");
|
||||||
}
|
}
|
||||||
|
@ -843,7 +842,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
|
||||||
method = ADD;
|
method = ADD;
|
||||||
amount *= -1;
|
amount *= -1;
|
||||||
} else {
|
} else {
|
||||||
return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all> <set|plus|minus n>'");
|
return cmd_results_new(CMD_INVALID, "gaps", expected_syntax);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == CURRENT) {
|
if (target == CURRENT) {
|
||||||
|
|
Loading…
Reference in a new issue