aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Ronan Pigott <rpigott@berkeley.edu>2019-11-04 15:10:40 -0700
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-11-04 21:16:27 -0500
commit3975ca28c2e870eb3f40bbd43a90354743f7ccf1 (patch)
treed35aa9aa8b0c17e94fb24359a13ab83547cafae5 /sway
parentAdd --custom to `output mode` command (diff)
downloadsway-3975ca28c2e870eb3f40bbd43a90354743f7ccf1.tar.gz
sway-3975ca28c2e870eb3f40bbd43a90354743f7ccf1.tar.zst
sway-3975ca28c2e870eb3f40bbd43a90354743f7ccf1.zip
smart_borders: separate smartness from edge types
Diffstat (limited to 'sway')
-rw-r--r--sway/commands/hide_edge_borders.c7
-rw-r--r--sway/commands/smart_borders.c8
-rw-r--r--sway/config.c2
-rw-r--r--sway/sway.5.scd12
-rw-r--r--sway/tree/view.c4
5 files changed, 17 insertions, 16 deletions
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