diff --git a/include/sway/commands.h b/include/sway/commands.h index 27058587..363ac831 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -116,6 +116,7 @@ sway_cmd cmd_client_focused; sway_cmd cmd_client_focused_inactive; sway_cmd cmd_client_focused_tab_title; sway_cmd cmd_client_unfocused; +sway_cmd cmd_client_unfocused_tab_title; sway_cmd cmd_client_urgent; sway_cmd cmd_client_placeholder; sway_cmd cmd_client_background; diff --git a/include/sway/config.h b/include/sway/config.h index 5ccc3e77..6e9f3280 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -571,12 +571,14 @@ struct sway_config { struct border_colors focused_inactive; struct border_colors focused_tab_title; struct border_colors unfocused; + struct border_colors unfocused_tab_title; struct border_colors urgent; struct border_colors placeholder; float background[4]; } border_colors; bool has_focused_tab_title; + bool has_unfocused_tab_title; // floating view int32_t floating_maximum_width; diff --git a/sway/commands.c b/sway/commands.c index 8d003dfa..efc1f050 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -54,6 +54,7 @@ static const struct cmd_handler handlers[] = { { "client.focused_tab_title", cmd_client_focused_tab_title }, { "client.placeholder", cmd_client_noop }, { "client.unfocused", cmd_client_unfocused }, + { "client.unfocused_tab_title", cmd_client_unfocused_tab_title }, { "client.urgent", cmd_client_urgent }, { "default_border", cmd_default_border }, { "default_floating_border", cmd_default_floating_border }, diff --git a/sway/commands/client.c b/sway/commands/client.c index fd2ac7a8..fb06b478 100644 --- a/sway/commands/client.c +++ b/sway/commands/client.c @@ -90,3 +90,13 @@ struct cmd_results *cmd_client_focused_tab_title(int argc, char **argv) { } return result; } + +struct cmd_results *cmd_client_unfocused_tab_title(int argc, char **argv) { + struct cmd_results *result = handle_command(argc, argv, + "client.unfocused_tab_title", + &config->border_colors.unfocused_tab_title, "#2e9ef4ff"); + if (result && result->status == CMD_SUCCESS) { + config->has_unfocused_tab_title = true; + } + return result; +} diff --git a/sway/config.c b/sway/config.c index f9131e0f..a753fbaf 100644 --- a/sway/config.c +++ b/sway/config.c @@ -308,6 +308,7 @@ static void config_defaults(struct sway_config *config) { config->hide_lone_tab = false; config->has_focused_tab_title = false; + config->has_unfocused_tab_title = false; // border colors color_to_rgba(config->border_colors.focused.border, 0x4C7899FF); diff --git a/sway/tree/container.c b/sway/tree/container.c index 80ef34fe..1ef7debe 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -175,6 +175,14 @@ static bool container_has_focused_child(struct sway_container *con) { return container_find_child(con, container_is_focused, NULL); } +static bool container_is_container(struct sway_container *con, void *data) { + return true; // intentional tautology +} + +static bool container_has_child(struct sway_container *con) { + return container_find_child(con, container_is_container, NULL); +} + static bool container_is_current_parent_focused(struct sway_container *con) { if (con->current.parent) { struct sway_container *parent = con->current.parent; @@ -211,6 +219,8 @@ static struct border_colors *container_get_current_colors( colors = &config->border_colors.focused_tab_title; } else if (con == active_child) { colors = &config->border_colors.focused_inactive; + } else if (config->has_unfocused_tab_title && container_has_child(con)) { + colors = &config->border_colors.unfocused_tab_title; } else { colors = &config->border_colors.unfocused; }