aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar D.B <thejan.2009@gmail.com>2016-11-02 21:07:04 +0100
committerLibravatar D.B <thejan.2009@gmail.com>2016-11-02 21:07:04 +0100
commit58eb7ac19fe436737babcbd1effd41ef96af6632 (patch)
treea3db9567c63b2b2bae27c17d3a103c8f2786a9f7 /sway/config.c
parentadd bar colours for focused_(workspace|statusline|separator) (diff)
downloadsway-58eb7ac19fe436737babcbd1effd41ef96af6632.tar.gz
sway-58eb7ac19fe436737babcbd1effd41ef96af6632.tar.zst
sway-58eb7ac19fe436737babcbd1effd41ef96af6632.zip
change bar colors from char[10] to *char
This commit removes has_* booleans from bar color struct. It also generalizes of functions in commands/bar/colors.c.
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c68
1 files changed, 50 insertions, 18 deletions
diff --git a/sway/config.c b/sway/config.c
index 6d4cf2ff..d790afa2 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -70,6 +70,28 @@ static void free_bar(struct bar_config *bar) {
70 terminate_swaybar(bar->pid); 70 terminate_swaybar(bar->pid);
71 } 71 }
72 72
73 free(bar->colors.background);
74 free(bar->colors.statusline);
75 free(bar->colors.separator);
76 free(bar->colors.focused_background);
77 free(bar->colors.focused_statusline);
78 free(bar->colors.focused_separator);
79 free(bar->colors.focused_workspace_border);
80 free(bar->colors.focused_workspace_bg);
81 free(bar->colors.focused_workspace_text);
82 free(bar->colors.active_workspace_border);
83 free(bar->colors.active_workspace_bg);
84 free(bar->colors.active_workspace_text);
85 free(bar->colors.inactive_workspace_border);
86 free(bar->colors.inactive_workspace_bg);
87 free(bar->colors.inactive_workspace_text);
88 free(bar->colors.urgent_workspace_border);
89 free(bar->colors.urgent_workspace_bg);
90 free(bar->colors.urgent_workspace_text);
91 free(bar->colors.binding_mode_border);
92 free(bar->colors.binding_mode_bg);
93 free(bar->colors.binding_mode_text);
94
73 free(bar); 95 free(bar);
74} 96}
75 97
@@ -1109,6 +1131,12 @@ struct sway_binding *sway_binding_dup(struct sway_binding *sb) {
1109 return new_sb; 1131 return new_sb;
1110} 1132}
1111 1133
1134static void set_bar_color(char **name, char *value) {
1135 // every color has 9 characters plus \0
1136 *name = malloc(10);
1137 strcpy(*name, value);
1138}
1139
1112struct bar_config *default_bar_config(void) { 1140struct bar_config *default_bar_config(void) {
1113 struct bar_config *bar = NULL; 1141 struct bar_config *bar = NULL;
1114 bar = malloc(sizeof(struct bar_config)); 1142 bar = malloc(sizeof(struct bar_config));
@@ -1132,24 +1160,28 @@ struct bar_config *default_bar_config(void) {
1132 bar->verbose = false; 1160 bar->verbose = false;
1133 bar->pid = 0; 1161 bar->pid = 0;
1134 // set default colors 1162 // set default colors
1135 strcpy(bar->colors.background, "#000000ff"); 1163 set_bar_color(&(bar->colors.background), "#000000ff");
1136 strcpy(bar->colors.statusline, "#ffffffff"); 1164 set_bar_color(&(bar->colors.statusline), "#ffffffff");
1137 strcpy(bar->colors.separator, "#666666ff"); 1165 set_bar_color(&(bar->colors.separator), "#666666ff");
1138 strcpy(bar->colors.focused_workspace_border, "#4c7899ff"); 1166 set_bar_color(&(bar->colors.focused_workspace_border), "#4c7899ff");
1139 strcpy(bar->colors.focused_workspace_bg, "#285577ff"); 1167 set_bar_color(&(bar->colors.focused_workspace_bg), "#285577ff");
1140 strcpy(bar->colors.focused_workspace_text, "#ffffffff"); 1168 set_bar_color(&(bar->colors.focused_workspace_text), "#ffffffff");
1141 strcpy(bar->colors.active_workspace_border, "#333333ff"); 1169 set_bar_color(&(bar->colors.active_workspace_border), "#333333ff");
1142 strcpy(bar->colors.active_workspace_bg, "#5f676aff"); 1170 set_bar_color(&(bar->colors.active_workspace_bg), "#5f676aff");
1143 strcpy(bar->colors.active_workspace_text, "#ffffffff"); 1171 set_bar_color(&(bar->colors.active_workspace_text), "#ffffffff");
1144 strcpy(bar->colors.inactive_workspace_border, "#333333ff"); 1172 set_bar_color(&(bar->colors.inactive_workspace_border), "#333333ff");
1145 strcpy(bar->colors.inactive_workspace_bg,"#222222ff"); 1173 set_bar_color(&(bar->colors.inactive_workspace_bg),"#222222ff");
1146 strcpy(bar->colors.inactive_workspace_text, "#888888ff"); 1174 set_bar_color(&(bar->colors.inactive_workspace_text), "#888888ff");
1147 strcpy(bar->colors.urgent_workspace_border, "#2f343aff"); 1175 set_bar_color(&(bar->colors.urgent_workspace_border), "#2f343aff");
1148 strcpy(bar->colors.urgent_workspace_bg,"#900000ff"); 1176 set_bar_color(&(bar->colors.urgent_workspace_bg),"#900000ff");
1149 strcpy(bar->colors.urgent_workspace_text, "#ffffffff"); 1177 set_bar_color(&(bar->colors.urgent_workspace_text), "#ffffffff");
1150 bar->colors.has_binding_mode_border = false; 1178
1151 bar->colors.has_binding_mode_bg = false; 1179 bar->colors.focused_background = NULL;
1152 bar->colors.has_binding_mode_text = false; 1180 bar->colors.focused_statusline = NULL;
1181 bar->colors.focused_separator = NULL;
1182 bar->colors.binding_mode_border = NULL;
1183 bar->colors.binding_mode_bg = NULL;
1184 bar->colors.binding_mode_text = NULL;
1153 1185
1154 list_add(config->bars, bar); 1186 list_add(config->bars, bar);
1155 1187