diff options
-rw-r--r-- | include/sway/config.h | 10 | ||||
-rw-r--r-- | sway/commands/hide_edge_borders.c | 7 | ||||
-rw-r--r-- | sway/commands/smart_borders.c | 8 | ||||
-rw-r--r-- | sway/config.c | 2 | ||||
-rw-r--r-- | sway/sway.5.scd | 12 | ||||
-rw-r--r-- | sway/tree/view.c | 4 |
6 files changed, 24 insertions, 19 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 3dedbec8..8c93c20d 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -334,8 +334,12 @@ enum edge_border_types { | |||
334 | E_VERTICAL, /**< hide vertical edge borders */ | 334 | E_VERTICAL, /**< hide vertical edge borders */ |
335 | E_HORIZONTAL, /**< hide horizontal edge borders */ | 335 | E_HORIZONTAL, /**< hide horizontal edge borders */ |
336 | E_BOTH, /**< hide vertical and horizontal edge borders */ | 336 | E_BOTH, /**< hide vertical and horizontal edge borders */ |
337 | E_SMART, /**< hide both if precisely one window is present in workspace */ | 337 | }; |
338 | E_SMART_NO_GAPS, /**< hide both if one window and gaps to edge is zero */ | 338 | |
339 | enum edge_border_smart_types { | ||
340 | ESMART_OFF, | ||
341 | ESMART_ON, /**< hide edges if precisely one window is present in workspace */ | ||
342 | ESMART_NO_GAPS, /**< hide edges if one window and gaps to edge is zero */ | ||
339 | }; | 343 | }; |
340 | 344 | ||
341 | enum sway_popup_during_fullscreen { | 345 | enum sway_popup_during_fullscreen { |
@@ -510,7 +514,7 @@ struct sway_config { | |||
510 | int border_thickness; | 514 | int border_thickness; |
511 | int floating_border_thickness; | 515 | int floating_border_thickness; |
512 | enum edge_border_types hide_edge_borders; | 516 | enum edge_border_types hide_edge_borders; |
513 | enum edge_border_types saved_edge_borders; | 517 | enum edge_border_smart_types hide_edge_borders_smart; |
514 | bool hide_lone_tab; | 518 | bool hide_lone_tab; |
515 | 519 | ||
516 | // border colors | 520 | // border colors |
diff --git a/sway/commands/hide_edge_borders.c b/sway/commands/hide_edge_borders.c index f69bece1..9a1d8445 100644 --- a/sway/commands/hide_edge_borders.c +++ b/sway/commands/hide_edge_borders.c | |||
@@ -32,14 +32,15 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) { | |||
32 | } else if (strcmp(argv[0], "both") == 0) { | 32 | } else if (strcmp(argv[0], "both") == 0) { |
33 | config->hide_edge_borders = E_BOTH; | 33 | config->hide_edge_borders = E_BOTH; |
34 | } else if (strcmp(argv[0], "smart") == 0) { | 34 | } else if (strcmp(argv[0], "smart") == 0) { |
35 | config->hide_edge_borders = E_SMART; | 35 | config->hide_edge_borders = E_NONE; |
36 | config->hide_edge_borders_smart = ESMART_ON; | ||
36 | } else if (strcmp(argv[0], "smart_no_gaps") == 0) { | 37 | } else if (strcmp(argv[0], "smart_no_gaps") == 0) { |
37 | config->hide_edge_borders = E_SMART_NO_GAPS; | 38 | config->hide_edge_borders = E_NONE; |
39 | config->hide_edge_borders_smart = ESMART_NO_GAPS; | ||
38 | } else { | 40 | } else { |
39 | return cmd_results_new(CMD_INVALID, expected_syntax); | 41 | return cmd_results_new(CMD_INVALID, expected_syntax); |
40 | } | 42 | } |
41 | config->hide_lone_tab = hide_lone_tab; | 43 | config->hide_lone_tab = hide_lone_tab; |
42 | config->saved_edge_borders = config->hide_edge_borders; | ||
43 | 44 | ||
44 | arrange_root(); | 45 | arrange_root(); |
45 | 46 | ||
diff --git a/sway/commands/smart_borders.c b/sway/commands/smart_borders.c index be346106..73878679 100644 --- a/sway/commands/smart_borders.c +++ b/sway/commands/smart_borders.c | |||
@@ -10,14 +10,12 @@ struct cmd_results *cmd_smart_borders(int argc, char **argv) { | |||
10 | return error; | 10 | return error; |
11 | } | 11 | } |
12 | 12 | ||
13 | enum edge_border_types saved = config->hide_edge_borders; | ||
14 | if (strcmp(argv[0], "no_gaps") == 0) { | 13 | if (strcmp(argv[0], "no_gaps") == 0) { |
15 | config->hide_edge_borders = E_SMART_NO_GAPS; | 14 | config->hide_edge_borders_smart = ESMART_NO_GAPS; |
16 | } else { | 15 | } else { |
17 | config->hide_edge_borders = parse_boolean(argv[0], true) ? | 16 | config->hide_edge_borders_smart = parse_boolean(argv[0], true) ? |
18 | E_SMART : config->saved_edge_borders; | 17 | ESMART_ON : ESMART_OFF; |
19 | } | 18 | } |
20 | config->saved_edge_borders = saved; | ||
21 | 19 | ||
22 | arrange_root(); | 20 | arrange_root(); |
23 | 21 | ||
diff --git a/sway/config.c b/sway/config.c index afc60a42..1f03610a 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -296,7 +296,7 @@ static void config_defaults(struct sway_config *config) { | |||
296 | config->border_thickness = 2; | 296 | config->border_thickness = 2; |
297 | config->floating_border_thickness = 2; | 297 | config->floating_border_thickness = 2; |
298 | config->hide_edge_borders = E_NONE; | 298 | config->hide_edge_borders = E_NONE; |
299 | config->saved_edge_borders = E_NONE; | 299 | config->hide_edge_borders_smart = ESMART_OFF; |
300 | config->hide_lone_tab = false; | 300 | config->hide_lone_tab = false; |
301 | 301 | ||
302 | // border colors | 302 | // border colors |
diff --git a/sway/sway.5.scd b/sway/sway.5.scd index 8315f8a1..9119b379 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd | |||
@@ -603,8 +603,10 @@ The default colors are: | |||
603 | 603 | ||
604 | *hide_edge_borders* [--i3] none|vertical|horizontal|both|smart|smart_no_gaps | 604 | *hide_edge_borders* [--i3] none|vertical|horizontal|both|smart|smart_no_gaps |
605 | Hides window borders adjacent to the screen edges. Default is _none_. The | 605 | Hides window borders adjacent to the screen edges. Default is _none_. The |
606 | _--i3_ option enables i3-compatible behavior to hide the title bar on tabbed | 606 | _--i3_ option enables i3-compatible behavior to hide the title bar on |
607 | and stacked containers with one child. | 607 | tabbed and stacked containers with one child. The _smart_|_smart_no_gaps_ |
608 | options are equivalent to setting _smart_borders_ smart|no_gaps and | ||
609 | _hide_edge_borders_ none. | ||
608 | 610 | ||
609 | *input* <input_device> <input-subcommands...> | 611 | *input* <input_device> <input-subcommands...> |
610 | For details on input subcommands, see *sway-input*(5). | 612 | For details on input subcommands, see *sway-input*(5). |
@@ -621,9 +623,9 @@ The default colors are: | |||
621 | 623 | ||
622 | *smart_borders* on|no_gaps|off | 624 | *smart_borders* on|no_gaps|off |
623 | If smart_borders are _on_, borders will only be enabled if the workspace | 625 | If smart_borders are _on_, borders will only be enabled if the workspace |
624 | has more than one visible child (identical to _hide_edge_borders_ smart). | 626 | has more than one visible child. If smart_borders is set to _no_gaps_, |
625 | If smart_borders is set to _no_gaps_, borders will only be enabled if the | 627 | borders will only be enabled if the workspace has more than one visible |
626 | workspace has more than one visible child and gaps equal to zero. | 628 | child and gaps equal to zero. |
627 | 629 | ||
628 | *smart_gaps* on|off | 630 | *smart_gaps* on|off |
629 | If smart_gaps are _on_ gaps will only be enabled if a workspace has more | 631 | If smart_gaps are _on_ gaps will only be enabled if a workspace has more |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 376cc332..93d4fefc 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -215,8 +215,8 @@ void view_autoconfigure(struct sway_view *view) { | |||
215 | 215 | ||
216 | if (!container_is_floating(con) && ws) { | 216 | if (!container_is_floating(con) && ws) { |
217 | 217 | ||
218 | bool smart = config->hide_edge_borders == E_SMART || | 218 | bool smart = config->hide_edge_borders_smart == ESMART_ON || |
219 | (config->hide_edge_borders == E_SMART_NO_GAPS && | 219 | (config->hide_edge_borders_smart == ESMART_NO_GAPS && |
220 | !gaps_to_edge(view)); | 220 | !gaps_to_edge(view)); |
221 | bool hide_smart = smart && view_is_only_visible(view); | 221 | bool hide_smart = smart && view_is_only_visible(view); |
222 | 222 | ||