mirror of https://github.com/swaywm/sway.git
Compare commits
5 Commits
3aea61f629
...
3a13b1ab8a
Author | SHA1 | Date |
---|---|---|
Sarunas Valaskevicius | 3a13b1ab8a | |
Kenny Levinsen | 646019cad9 | |
Sarunas Valaskevicius | 07ec10171d | |
Sarunas Valaskevicius | 80e31052b3 | |
Guilhem Saurel | 72d32e2ddf |
|
@ -564,6 +564,7 @@ struct sway_config {
|
||||||
enum edge_border_types hide_edge_borders;
|
enum edge_border_types hide_edge_borders;
|
||||||
enum edge_border_smart_types hide_edge_borders_smart;
|
enum edge_border_smart_types hide_edge_borders_smart;
|
||||||
bool hide_lone_tab;
|
bool hide_lone_tab;
|
||||||
|
bool hide_lone_title;
|
||||||
|
|
||||||
// border colors
|
// border colors
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -13,7 +13,13 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hide_lone_tab = false;
|
bool hide_lone_tab = false;
|
||||||
if (strcmp(*argv, "--i3") == 0) {
|
bool hide_lone_title = false;
|
||||||
|
if (strcmp(*argv, "--smart-titles") == 0) {
|
||||||
|
hide_lone_tab = true;
|
||||||
|
hide_lone_title = true;
|
||||||
|
++argv;
|
||||||
|
--argc;
|
||||||
|
} else if (strcmp(*argv, "--i3") == 0) {
|
||||||
hide_lone_tab = true;
|
hide_lone_tab = true;
|
||||||
++argv;
|
++argv;
|
||||||
--argc;
|
--argc;
|
||||||
|
@ -41,6 +47,7 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_INVALID, "%s", expected_syntax);
|
return cmd_results_new(CMD_INVALID, "%s", expected_syntax);
|
||||||
}
|
}
|
||||||
config->hide_lone_tab = hide_lone_tab;
|
config->hide_lone_tab = hide_lone_tab;
|
||||||
|
config->hide_lone_title = hide_lone_title;
|
||||||
|
|
||||||
arrange_root();
|
arrange_root();
|
||||||
|
|
||||||
|
|
|
@ -306,6 +306,7 @@ static void config_defaults(struct sway_config *config) {
|
||||||
config->hide_edge_borders = E_NONE;
|
config->hide_edge_borders = E_NONE;
|
||||||
config->hide_edge_borders_smart = ESMART_OFF;
|
config->hide_edge_borders_smart = ESMART_OFF;
|
||||||
config->hide_lone_tab = false;
|
config->hide_lone_tab = false;
|
||||||
|
config->hide_lone_title = false;
|
||||||
|
|
||||||
config->has_focused_tab_title = false;
|
config->has_focused_tab_title = false;
|
||||||
|
|
||||||
|
|
|
@ -619,7 +619,7 @@ static void output_manager_apply(struct sway_server *server,
|
||||||
if (!test_only && ok) {
|
if (!test_only && ok) {
|
||||||
struct wlr_output_configuration_head_v1 *config_head;
|
struct wlr_output_configuration_head_v1 *config_head;
|
||||||
wl_list_for_each(config_head, &config->heads, link) {
|
wl_list_for_each(config_head, &config->heads, link) {
|
||||||
if (config_head->state.output == sway_output->wlr_output) {
|
if (config_head->state.output == cfg->output->wlr_output) {
|
||||||
store_config = true;
|
store_config = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,14 +287,13 @@ static void arrange_container(struct sway_container *con,
|
||||||
|
|
||||||
static void arrange_children(enum sway_container_layout layout, list_t *children,
|
static void arrange_children(enum sway_container_layout layout, list_t *children,
|
||||||
struct sway_container *active, struct wlr_scene_tree *content,
|
struct sway_container *active, struct wlr_scene_tree *content,
|
||||||
int width, int height, int gaps) {
|
int width, int height, int gaps, bool parent_asks_for_title_bars) {
|
||||||
int title_bar_height = container_titlebar_height();
|
int title_bar_height = container_titlebar_height();
|
||||||
|
|
||||||
if (layout == L_TABBED) {
|
if (layout == L_TABBED) {
|
||||||
struct sway_container *first = children->length == 1 ?
|
bool show_titlebar = parent_asks_for_title_bars || !config->hide_lone_tab ||
|
||||||
((struct sway_container *)children->items[0]) : NULL;
|
(children->length > 1);
|
||||||
if (config->hide_lone_tab && first && first->view &&
|
if (!show_titlebar) {
|
||||||
first->current.border != B_NORMAL) {
|
|
||||||
title_bar_height = 0;
|
title_bar_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,8 +311,7 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
|
||||||
wlr_scene_node_reparent(&child->scene_tree->node, content);
|
wlr_scene_node_reparent(&child->scene_tree->node, content);
|
||||||
|
|
||||||
if (activated) {
|
if (activated) {
|
||||||
arrange_container(child, width, height - title_bar_height,
|
arrange_container(child, width, height - title_bar_height, false, 0);
|
||||||
false, 0);
|
|
||||||
} else {
|
} else {
|
||||||
disable_container(child);
|
disable_container(child);
|
||||||
}
|
}
|
||||||
|
@ -321,10 +319,9 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
|
||||||
title_offset = next_title_offset;
|
title_offset = next_title_offset;
|
||||||
}
|
}
|
||||||
} else if (layout == L_STACKED) {
|
} else if (layout == L_STACKED) {
|
||||||
struct sway_container *first = children->length == 1 ?
|
bool show_titlebar = parent_asks_for_title_bars || !config->hide_lone_tab ||
|
||||||
((struct sway_container *)children->items[0]) : NULL;
|
(children->length > 1);
|
||||||
if (config->hide_lone_tab && first && first->view &&
|
if (!show_titlebar) {
|
||||||
first->current.border != B_NORMAL) {
|
|
||||||
title_bar_height = 0;
|
title_bar_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,8 +338,7 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
|
||||||
wlr_scene_node_reparent(&child->scene_tree->node, content);
|
wlr_scene_node_reparent(&child->scene_tree->node, content);
|
||||||
|
|
||||||
if (activated) {
|
if (activated) {
|
||||||
arrange_container(child, width, height - title_height,
|
arrange_container(child, width, height - title_height, false, 0);
|
||||||
false, 0);
|
|
||||||
} else {
|
} else {
|
||||||
disable_container(child);
|
disable_container(child);
|
||||||
}
|
}
|
||||||
|
@ -351,6 +347,8 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
|
||||||
}
|
}
|
||||||
} else if (layout == L_VERT) {
|
} else if (layout == L_VERT) {
|
||||||
int off = 0;
|
int off = 0;
|
||||||
|
bool show_titlebar = parent_asks_for_title_bars || !config->hide_lone_tab ||
|
||||||
|
(children->length > 1);
|
||||||
for (int i = 0; i < children->length; i++) {
|
for (int i = 0; i < children->length; i++) {
|
||||||
struct sway_container *child = children->items[i];
|
struct sway_container *child = children->items[i];
|
||||||
int cheight = child->current.height;
|
int cheight = child->current.height;
|
||||||
|
@ -358,11 +356,13 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
|
||||||
wlr_scene_node_set_enabled(&child->border.tree->node, true);
|
wlr_scene_node_set_enabled(&child->border.tree->node, true);
|
||||||
wlr_scene_node_set_position(&child->scene_tree->node, 0, off);
|
wlr_scene_node_set_position(&child->scene_tree->node, 0, off);
|
||||||
wlr_scene_node_reparent(&child->scene_tree->node, content);
|
wlr_scene_node_reparent(&child->scene_tree->node, content);
|
||||||
arrange_container(child, width, cheight, true, gaps);
|
arrange_container(child, width, cheight, show_titlebar, gaps);
|
||||||
off += cheight + gaps;
|
off += cheight + gaps;
|
||||||
}
|
}
|
||||||
} else if (layout == L_HORIZ) {
|
} else if (layout == L_HORIZ) {
|
||||||
int off = 0;
|
int off = 0;
|
||||||
|
bool show_titlebar = parent_asks_for_title_bars || !config->hide_lone_tab ||
|
||||||
|
(children->length > 1);
|
||||||
for (int i = 0; i < children->length; i++) {
|
for (int i = 0; i < children->length; i++) {
|
||||||
struct sway_container *child = children->items[i];
|
struct sway_container *child = children->items[i];
|
||||||
int cwidth = child->current.width;
|
int cwidth = child->current.width;
|
||||||
|
@ -370,7 +370,7 @@ static void arrange_children(enum sway_container_layout layout, list_t *children
|
||||||
wlr_scene_node_set_enabled(&child->border.tree->node, true);
|
wlr_scene_node_set_enabled(&child->border.tree->node, true);
|
||||||
wlr_scene_node_set_position(&child->scene_tree->node, off, 0);
|
wlr_scene_node_set_position(&child->scene_tree->node, off, 0);
|
||||||
wlr_scene_node_reparent(&child->scene_tree->node, content);
|
wlr_scene_node_reparent(&child->scene_tree->node, content);
|
||||||
arrange_container(child, cwidth, height, true, gaps);
|
arrange_container(child, cwidth, height, show_titlebar, gaps);
|
||||||
off += cwidth + gaps;
|
off += cwidth + gaps;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -452,7 +452,7 @@ static void arrange_container(struct sway_container *con,
|
||||||
|
|
||||||
arrange_children(con->current.layout, con->current.children,
|
arrange_children(con->current.layout, con->current.children,
|
||||||
con->current.focused_inactive_child, con->content_tree,
|
con->current.focused_inactive_child, con->content_tree,
|
||||||
width, height, gaps);
|
width, height, gaps, title_bar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ static void arrange_workspace_tiling(struct sway_workspace *ws,
|
||||||
int width, int height) {
|
int width, int height) {
|
||||||
arrange_children(ws->current.layout, ws->current.tiling,
|
arrange_children(ws->current.layout, ws->current.tiling,
|
||||||
ws->current.focused_inactive_child, ws->layers.tiling,
|
ws->current.focused_inactive_child, ws->layers.tiling,
|
||||||
width, height, ws->gaps_inner);
|
width, height, ws->gaps_inner, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disable_workspace(struct sway_workspace *ws) {
|
static void disable_workspace(struct sway_workspace *ws) {
|
||||||
|
|
|
@ -747,10 +747,11 @@ The default colors are:
|
||||||
This affects new workspaces only, and is used when the workspace doesn't
|
This affects new workspaces only, and is used when the workspace doesn't
|
||||||
have its own gaps settings (see: workspace <ws> gaps ...).
|
have its own gaps settings (see: workspace <ws> gaps ...).
|
||||||
|
|
||||||
*hide_edge_borders* [--i3] none|vertical|horizontal|both|smart|smart_no_gaps
|
*hide_edge_borders* [--i3 | --smart-titles] none|vertical|horizontal|both|smart|smart_no_gaps
|
||||||
Hides window borders adjacent to the screen edges. Default is _none_. The
|
Hides window borders adjacent to the screen edges. Default is _none_. The
|
||||||
_--i3_ option enables i3-compatible behavior to hide the title bar on
|
_--i3_ option enables i3-compatible behavior to hide the title bar on
|
||||||
tabbed and stacked containers with one child. The _smart_|_smart_no_gaps_
|
tabbed and stacked containers with one child. The --smart-titles option
|
||||||
|
hide the title bar on workspaces with only one child. The _smart_|_smart_no_gaps_
|
||||||
options are equivalent to setting _smart_borders_ smart|no_gaps and
|
options are equivalent to setting _smart_borders_ smart|no_gaps and
|
||||||
_hide_edge_borders_ none.
|
_hide_edge_borders_ none.
|
||||||
|
|
||||||
|
|
|
@ -356,8 +356,14 @@ void view_autoconfigure(struct sway_view *view) {
|
||||||
height = con->pending.height - y_offset
|
height = con->pending.height - y_offset
|
||||||
- con->pending.border_thickness * con->pending.border_bottom;
|
- con->pending.border_thickness * con->pending.border_bottom;
|
||||||
} else {
|
} else {
|
||||||
y = con->pending.y + container_titlebar_height();
|
int titlebar_height;
|
||||||
height = con->pending.height - container_titlebar_height()
|
if (config->hide_lone_title && view_is_only_visible(view)) {
|
||||||
|
titlebar_height = con->pending.border_thickness * con->pending.border_top + y_offset;
|
||||||
|
} else {
|
||||||
|
titlebar_height = container_titlebar_height();
|
||||||
|
}
|
||||||
|
y = con->pending.y + titlebar_height;
|
||||||
|
height = con->pending.height - titlebar_height
|
||||||
- con->pending.border_thickness * con->pending.border_bottom;
|
- con->pending.border_thickness * con->pending.border_bottom;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue