aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/config.h1
-rw-r--r--sway/commands/hide_edge_borders.c10
-rw-r--r--sway/config.c1
-rw-r--r--sway/desktop/render.c8
-rw-r--r--sway/sway.5.scd6
-rw-r--r--sway/tree/view.c19
6 files changed, 33 insertions, 12 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index ab494e78..46ca7cee 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -465,6 +465,7 @@ struct sway_config {
465 int floating_border_thickness; 465 int floating_border_thickness;
466 enum edge_border_types hide_edge_borders; 466 enum edge_border_types hide_edge_borders;
467 enum edge_border_types saved_edge_borders; 467 enum edge_border_types saved_edge_borders;
468 bool hide_lone_tab;
468 469
469 // border colors 470 // border colors
470 struct { 471 struct {
diff --git a/sway/commands/hide_edge_borders.c b/sway/commands/hide_edge_borders.c
index 84a217b8..6120a17f 100644
--- a/sway/commands/hide_edge_borders.c
+++ b/sway/commands/hide_edge_borders.c
@@ -5,10 +5,16 @@
5 5
6struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) { 6struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
7 struct cmd_results *error = NULL; 7 struct cmd_results *error = NULL;
8 if ((error = checkarg(argc, "hide_edge_borders", EXPECTED_EQUAL_TO, 1))) { 8 if ((error = checkarg(argc, "hide_edge_borders", EXPECTED_AT_LEAST, 1))) {
9 return error; 9 return error;
10 } 10 }
11 11
12 if (strcmp(*argv, "--i3") == 0) {
13 config->hide_lone_tab = true;
14 ++argv;
15 --argc;
16 }
17
12 if (strcmp(argv[0], "none") == 0) { 18 if (strcmp(argv[0], "none") == 0) {
13 config->hide_edge_borders = E_NONE; 19 config->hide_edge_borders = E_NONE;
14 } else if (strcmp(argv[0], "vertical") == 0) { 20 } else if (strcmp(argv[0], "vertical") == 0) {
@@ -23,7 +29,7 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
23 config->hide_edge_borders = E_SMART_NO_GAPS; 29 config->hide_edge_borders = E_SMART_NO_GAPS;
24 } else { 30 } else {
25 return cmd_results_new(CMD_INVALID, "Expected 'hide_edge_borders " 31 return cmd_results_new(CMD_INVALID, "Expected 'hide_edge_borders "
26 "<none|vertical|horizontal|both|smart|smart_no_gaps>'"); 32 "[--i3] <none|vertical|horizontal|both|smart|smart_no_gaps>'");
27 } 33 }
28 config->saved_edge_borders = config->hide_edge_borders; 34 config->saved_edge_borders = config->hide_edge_borders;
29 35
diff --git a/sway/config.c b/sway/config.c
index 4cd21bbc..48bbd1ea 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -261,6 +261,7 @@ static void config_defaults(struct sway_config *config) {
261 config->floating_border_thickness = 2; 261 config->floating_border_thickness = 2;
262 config->hide_edge_borders = E_NONE; 262 config->hide_edge_borders = E_NONE;
263 config->saved_edge_borders = E_NONE; 263 config->saved_edge_borders = E_NONE;
264 config->hide_lone_tab = false;
264 265
265 // border colors 266 // border colors
266 set_color(config->border_colors.focused.border, 0x4C7899); 267 set_color(config->border_colors.focused.border, 0x4C7899);
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 92e623ef..5df16075 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -841,6 +841,14 @@ static void render_containers_stacked(struct sway_output *output,
841 841
842static void render_containers(struct sway_output *output, 842static void render_containers(struct sway_output *output,
843 pixman_region32_t *damage, struct parent_data *parent) { 843 pixman_region32_t *damage, struct parent_data *parent) {
844 if (config->hide_lone_tab && parent->children->length == 1) {
845 struct sway_container *child = parent->children->items[0];
846 if (child->view) {
847 render_containers_linear(output,damage, parent);
848 return;
849 }
850 }
851
844 switch (parent->layout) { 852 switch (parent->layout) {
845 case L_NONE: 853 case L_NONE:
846 case L_HORIZ: 854 case L_HORIZ:
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index 1affca5f..c0ec85cd 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -493,8 +493,10 @@ The default colors are:
493 This affects new workspaces only, and is used when the workspace doesn't 493 This affects new workspaces only, and is used when the workspace doesn't
494 have its own gaps settings (see: workspace <ws> gaps ...). 494 have its own gaps settings (see: workspace <ws> gaps ...).
495 495
496*hide_edge_borders* none|vertical|horizontal|both|smart|smart_no_gaps 496*hide_edge_borders* [--i3] none|vertical|horizontal|both|smart|smart_no_gaps
497 Hides window borders adjacent to the screen edges. Default is _none_. 497 Hides window borders adjacent to the screen edges. Default is _none_. The
498 _--i3_ option enables i3-compatible behavior to hide the title bar on tabbed
499 and stacked containers with one child.
498 500
499*input* <input_device> <input-subcommands...> 501*input* <input_device> <input-subcommands...>
500 For details on input subcommands, see *sway-input*(5). 502 For details on input subcommands, see *sway-input*(5).
diff --git a/sway/tree/view.c b/sway/tree/view.c
index ca13def7..14cc07d9 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -246,14 +246,17 @@ void view_autoconfigure(struct sway_view *view) {
246 // In a tabbed or stacked container, the container's y is the top of the 246 // In a tabbed or stacked container, the container's y is the top of the
247 // title area. We have to offset the surface y by the height of the title, 247 // title area. We have to offset the surface y by the height of the title,
248 // bar, and disable any top border because we'll always have the title bar. 248 // bar, and disable any top border because we'll always have the title bar.
249 enum sway_container_layout layout = container_parent_layout(con); 249 list_t *siblings = container_get_siblings(con);
250 if (layout == L_TABBED && !container_is_floating(con)) { 250 bool show_titlebar = siblings->length > 1 || !config->hide_lone_tab;
251 y_offset = container_titlebar_height(); 251 if (show_titlebar && !container_is_floating(con)) {
252 con->border_top = false; 252 enum sway_container_layout layout = container_parent_layout(con);
253 } else if (layout == L_STACKED && !container_is_floating(con)) { 253 if (layout == L_TABBED) {
254 list_t *siblings = container_get_siblings(con); 254 y_offset = container_titlebar_height();
255 y_offset = container_titlebar_height() * siblings->length; 255 con->border_top = false;
256 con->border_top = false; 256 } else if (layout == L_STACKED) {
257 y_offset = container_titlebar_height() * siblings->length;
258 con->border_top = false;
259 }
257 } 260 }
258 261
259 double x, y, width, height; 262 double x, y, width, height;