mirror of
https://github.com/swaywm/sway.git
synced 2025-11-23 06:59:48 -05:00
add bar colours for focused_(workspace|statusline|separator)
If these aren't defined in config, color settings without 'focused_' prefix are used as a fallback.
This commit is contained in:
parent
39ee0ec552
commit
ad4d21d60b
9 changed files with 124 additions and 6 deletions
|
|
@ -277,6 +277,9 @@ static struct cmd_handler bar_colors_handlers[] = {
|
|||
{ "active_workspace", bar_colors_cmd_active_workspace },
|
||||
{ "background", bar_colors_cmd_background },
|
||||
{ "binding_mode", bar_colors_cmd_binding_mode },
|
||||
{ "focused_background", bar_colors_cmd_focused_background },
|
||||
{ "focused_separator", bar_colors_cmd_focused_separator },
|
||||
{ "focused_statusline", bar_colors_cmd_focused_statusline },
|
||||
{ "focused_workspace", bar_colors_cmd_focused_workspace },
|
||||
{ "inactive_workspace", bar_colors_cmd_inactive_workspace },
|
||||
{ "separator", bar_colors_cmd_separator },
|
||||
|
|
|
|||
|
|
@ -49,6 +49,21 @@ struct cmd_results *bar_colors_cmd_background(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
struct cmd_results *bar_colors_cmd_focused_background(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "focused_background", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = add_color("focused_background", config->current_bar->colors.focused_background, argv[0]))) {
|
||||
return error;
|
||||
}else {
|
||||
config->current_bar->colors.has_focused_background = true;
|
||||
}
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
struct cmd_results *bar_colors_cmd_binding_mode(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "binding_mode", EXPECTED_EQUAL_TO, 3))) {
|
||||
|
|
@ -131,6 +146,21 @@ struct cmd_results *bar_colors_cmd_separator(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
struct cmd_results *bar_colors_cmd_focused_separator(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "focused_separator", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = add_color("focused_separator", config->current_bar->colors.focused_separator, argv[0]))) {
|
||||
return error;
|
||||
} else {
|
||||
config->current_bar->colors.has_focused_separator = true;
|
||||
}
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
struct cmd_results *bar_colors_cmd_statusline(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "statusline", EXPECTED_EQUAL_TO, 1))) {
|
||||
|
|
@ -144,6 +174,21 @@ struct cmd_results *bar_colors_cmd_statusline(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
struct cmd_results *bar_colors_cmd_focused_statusline(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "focused_statusline", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = add_color("focused_statusline", config->current_bar->colors.focused_statusline, argv[0]))) {
|
||||
return error;
|
||||
} else {
|
||||
config->current_bar->colors.has_focused_statusline = true;
|
||||
}
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
||||
struct cmd_results *bar_colors_cmd_urgent_workspace(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "urgent_workspace", EXPECTED_EQUAL_TO, 3))) {
|
||||
|
|
|
|||
|
|
@ -312,6 +312,24 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) {
|
|||
json_object_object_add(colors, "statusline", json_object_new_string(bar->colors.statusline));
|
||||
json_object_object_add(colors, "separator", json_object_new_string(bar->colors.separator));
|
||||
|
||||
if (bar->colors.has_focused_background) {
|
||||
json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.focused_background));
|
||||
} else {
|
||||
json_object_object_add(colors, "focused_background", json_object_new_string(bar->colors.background));
|
||||
}
|
||||
|
||||
if (bar->colors.has_focused_statusline) {
|
||||
json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.focused_statusline));
|
||||
} else {
|
||||
json_object_object_add(colors, "focused_statusline", json_object_new_string(bar->colors.statusline));
|
||||
}
|
||||
|
||||
if (bar->colors.has_focused_separator) {
|
||||
json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.focused_separator));
|
||||
} else {
|
||||
json_object_object_add(colors, "focused_separator", json_object_new_string(bar->colors.separator));
|
||||
}
|
||||
|
||||
json_object_object_add(colors, "focused_workspace_border", json_object_new_string(bar->colors.focused_workspace_border));
|
||||
json_object_object_add(colors, "focused_workspace_bg", json_object_new_string(bar->colors.focused_workspace_bg));
|
||||
json_object_object_add(colors, "focused_workspace_text", json_object_new_string(bar->colors.focused_workspace_text));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue