Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement hide_edge_borders smart (like in i3 4.13) #1044

Merged
merged 1 commit into from Jan 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/sway/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions sway/commands/hide_edge_borders.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>'");
Expand Down
7 changes: 7 additions & 0 deletions sway/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down