Skip to content

Commit

Permalink
add --title flag to hide_edge_borders, fix swaywm#7409
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Dec 29, 2023
1 parent 0aceff7 commit f4ec32d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/sway/config.h
Expand Up @@ -556,6 +556,7 @@ struct sway_config {
enum edge_border_types hide_edge_borders;
enum edge_border_smart_types hide_edge_borders_smart;
bool hide_lone_tab;
bool hide_lone_title;

// border colors
struct {
Expand Down
6 changes: 6 additions & 0 deletions sway/commands/hide_edge_borders.c
Expand Up @@ -13,10 +13,15 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
}

bool hide_lone_tab = false;
bool hide_lone_title = false;
if (strcmp(*argv, "--i3") == 0) {
hide_lone_tab = true;
++argv;
--argc;
} else if (strcmp(*argv, "--title") == 0) {
hide_lone_title = true;
++argv;
--argc;
}

if (!argc) {
Expand All @@ -41,6 +46,7 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, "%s", expected_syntax);
}
config->hide_lone_tab = hide_lone_tab;
config->hide_lone_title = hide_lone_title;

arrange_root();

Expand Down
1 change: 1 addition & 0 deletions sway/config.c
Expand Up @@ -298,6 +298,7 @@ static void config_defaults(struct sway_config *config) {
config->hide_edge_borders = E_NONE;
config->hide_edge_borders_smart = ESMART_OFF;
config->hide_lone_tab = false;
config->hide_lone_title = false;

config->has_focused_tab_title = false;

Expand Down
5 changes: 3 additions & 2 deletions sway/sway.5.scd
Expand Up @@ -741,10 +741,11 @@ The default colors are:
This affects new workspaces only, and is used when the workspace doesn't
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 | --title] 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. The _smart_|_smart_no_gaps_
tabbed and stacked containers with one child. The --title option hide
the title bar on containers with one child. The _smart_|_smart_no_gaps_
options are equivalent to setting _smart_borders_ smart|no_gaps and
_hide_edge_borders_ none.

Expand Down
3 changes: 2 additions & 1 deletion sway/tree/view.c
Expand Up @@ -300,7 +300,8 @@ void view_autoconfigure(struct sway_view *view) {
// bar, and disable any top border because we'll always have the title bar.
list_t *siblings = container_get_siblings(con);
bool show_titlebar = (siblings && siblings->length > 1)
|| !config->hide_lone_tab;
|| !config->hide_lone_tab
|| !config->hide_lone_title;
if (show_titlebar) {
enum sway_container_layout layout = container_parent_layout(con);
if (layout == L_TABBED) {
Expand Down

0 comments on commit f4ec32d

Please sign in to comment.