aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-01-12 11:39:31 -0500
committerGitHub <noreply@github.com>2017-01-12 11:39:31 -0500
commitc1e6cc3257e5f37438e661427d625168a76ecc27 (patch)
tree29103307c7df0ae02849e937bce8045a9e24c697
parent307e8afde29fcd4b51cd25d34b465980a0bfd686 (diff)
parentc04819e8c080e40e1e872c8624c60c4a51087019 (diff)
downloadsway-c1e6cc3257e5f37438e661427d625168a76ecc27.zip
sway-c1e6cc3257e5f37438e661427d625168a76ecc27.tar.gz
sway-c1e6cc3257e5f37438e661427d625168a76ecc27.tar.bz2
Merge pull request #1044 from ametisf/master
Implement hide_edge_borders smart (like in i3 4.13)
-rw-r--r--include/sway/config.h3
-rw-r--r--sway/commands/hide_edge_borders.c2
-rw-r--r--sway/layout.c7
3 files changed, 11 insertions, 1 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index 4a14cd3..febde63 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -178,7 +178,8 @@ enum edge_border_types {
E_NONE, /**< Don't hide edge borders */
E_VERTICAL, /**< hide vertical edge borders */
E_HORIZONTAL, /**< hide horizontal edge borders */
- E_BOTH /**< hide vertical and horizontal edge borders */
+ E_BOTH, /**< hide vertical and horizontal edge borders */
+ E_SMART /**< hide both if precisely one window is present in workspace */
};
enum command_context {
diff --git a/sway/commands/hide_edge_borders.c b/sway/commands/hide_edge_borders.c
index 0be940c..cb4f052 100644
--- a/sway/commands/hide_edge_borders.c
+++ b/sway/commands/hide_edge_borders.c
@@ -15,6 +15,8 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
config->hide_edge_borders = E_HORIZONTAL;
} else if (strcasecmp(argv[0], "both") == 0) {
config->hide_edge_borders = E_BOTH;
+ } else if (strcasecmp(argv[0], "smart") == 0) {
+ config->hide_edge_borders = E_SMART;
} else {
return cmd_results_new(CMD_INVALID, "hide_edge_borders",
"Expected 'hide_edge_borders <none|vertical|horizontal|both>'");
diff --git a/sway/layout.c b/sway/layout.c
index ea4a680..bb37a36 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -665,6 +665,13 @@ void update_geometry(swayc_t *container) {
border_bottom = 0;
}
}
+
+ if (config->hide_edge_borders == E_SMART && workspace->children->length == 1) {
+ border_top = 0;
+ border_bottom = 0;
+ border_left = 0;
+ border_right = 0;
+ }
}
int title_bar_height = config->font_height + 4; //borders + padding