mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 08:51:27 +00:00
feat(container): add config |unfocused_tab_title|
This commit is contained in:
parent
9704152414
commit
d84a73f1e5
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue