aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorRonan Pigott <rpigott@berkeley.edu>2019-11-04 15:10:40 -0700
committerBrian Ashworth <bosrsf04@gmail.com>2019-11-04 21:16:27 -0500
commit3975ca28c2e870eb3f40bbd43a90354743f7ccf1 (patch)
treed35aa9aa8b0c17e94fb24359a13ab83547cafae5 /sway
parent38b37247ff26b7c0926a8d31c1a91f818d1f5d84 (diff)
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) {
} else if (strcmp(argv[0], "both") == 0) {
config->hide_edge_borders = E_BOTH;
} else if (strcmp(argv[0], "smart") == 0) {
- config->hide_edge_borders = E_SMART;
+ config->hide_edge_borders = E_NONE;
+ config->hide_edge_borders_smart = ESMART_ON;
} else if (strcmp(argv[0], "smart_no_gaps") == 0) {
- config->hide_edge_borders = E_SMART_NO_GAPS;
+ config->hide_edge_borders = E_NONE;
+ config->hide_edge_borders_smart = ESMART_NO_GAPS;
} else {
return cmd_results_new(CMD_INVALID, expected_syntax);
}
config->hide_lone_tab = hide_lone_tab;
- config->saved_edge_borders = config->hide_edge_borders;
arrange_root();
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) {
return error;
}
- enum edge_border_types saved = config->hide_edge_borders;
if (strcmp(argv[0], "no_gaps") == 0) {
- config->hide_edge_borders = E_SMART_NO_GAPS;
+ config->hide_edge_borders_smart = ESMART_NO_GAPS;
} else {
- config->hide_edge_borders = parse_boolean(argv[0], true) ?
- E_SMART : config->saved_edge_borders;
+ config->hide_edge_borders_smart = parse_boolean(argv[0], true) ?
+ ESMART_ON : ESMART_OFF;
}
- config->saved_edge_borders = saved;
arrange_root();
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) {
config->border_thickness = 2;
config->floating_border_thickness = 2;
config->hide_edge_borders = E_NONE;
- config->saved_edge_borders = E_NONE;
+ config->hide_edge_borders_smart = ESMART_OFF;
config->hide_lone_tab = false;
// 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:
*hide_edge_borders* [--i3] none|vertical|horizontal|both|smart|smart_no_gaps
Hides window borders adjacent to the screen edges. Default is _none_. The
- _--i3_ option enables i3-compatible behavior to hide the title bar on tabbed
- and stacked containers with one child.
+ _--i3_ option enables i3-compatible behavior to hide the title bar on
+ tabbed and stacked containers with one child. The _smart_|_smart_no_gaps_
+ options are equivalent to setting _smart_borders_ smart|no_gaps and
+ _hide_edge_borders_ none.
*input* <input_device> <input-subcommands...>
For details on input subcommands, see *sway-input*(5).
@@ -621,9 +623,9 @@ The default colors are:
*smart_borders* on|no_gaps|off
If smart_borders are _on_, borders will only be enabled if the workspace
- has more than one visible child (identical to _hide_edge_borders_ smart).
- If smart_borders is set to _no_gaps_, borders will only be enabled if the
- workspace has more than one visible child and gaps equal to zero.
+ has more than one visible child. If smart_borders is set to _no_gaps_,
+ borders will only be enabled if the workspace has more than one visible
+ child and gaps equal to zero.
*smart_gaps* on|off
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) {
if (!container_is_floating(con) && ws) {
- bool smart = config->hide_edge_borders == E_SMART ||
- (config->hide_edge_borders == E_SMART_NO_GAPS &&
+ bool smart = config->hide_edge_borders_smart == ESMART_ON ||
+ (config->hide_edge_borders_smart == ESMART_NO_GAPS &&
!gaps_to_edge(view));
bool hide_smart = smart && view_is_only_visible(view);