mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 07:56:31 +01:00
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.
This commit is contained in:
parent
4d6be1b640
commit
0ad7857f90
3 changed files with 40 additions and 1 deletions
|
@ -227,11 +227,12 @@ 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;
|
||||
int32_t floating_minimum_height;
|
||||
char *floating_minimum_size;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -178,6 +178,8 @@ static void config_defaults(struct sway_config *config) {
|
|||
config->floating_minimum_width = 75;
|
||||
config->floating_minimum_height = 50;
|
||||
|
||||
config->floating_minimum_size = strdup("");
|
||||
|
||||
// Flags
|
||||
config->focus_follows_mouse = true;
|
||||
config->mouse_warping = true;
|
||||
|
|
Loading…
Reference in a new issue