fix crash on initializing colorschemes
This commit is contained in:
parent
9ca0c8c715
commit
6ba83ad46b
44
config.h
44
config.h
|
@ -20,24 +20,34 @@ static const char *fonts[] = {
|
|||
"monospace:pixelsize=30",
|
||||
};
|
||||
|
||||
static const char colors[][7] = {
|
||||
[0] = "#15161E", [1] = "#f7768e", [2] = "#9ece6a", [3] = "#e0af68",
|
||||
[4] = "#7aa2f7", [5] = "#bb9af7", [6] = "#7dcfff", [7] = "#a9b1d6",
|
||||
[8] = "#414868", [9] = "#f7768e", [10] = "#9ece6a", [11] = "#e0af68",
|
||||
[12] = "#7aa2f7", [13] = "#bb9af7", [14] = "#7dcfff", [15] = "#c0caf5",
|
||||
/* Extra Colors (not accessible with SGR escapes) */
|
||||
[16] = "#383c4a", [17] = "#7aa2f7",
|
||||
};
|
||||
static const char color0[] = "#15161E";
|
||||
static const char color1[] = "#f7768e";
|
||||
static const char color2[] = "#9ece6a";
|
||||
static const char color3[] = "#e0af68";
|
||||
static const char color4[] = "#7aa2f7";
|
||||
static const char color5[] = "#bb9af7";
|
||||
static const char color6[] = "#7dcfff";
|
||||
static const char color7[] = "#a9b1d6";
|
||||
static const char color8[] = "#414868";
|
||||
static const char color9[] = "#f7768e";
|
||||
static const char color10[] = "#9ece6a";
|
||||
static const char color11[] = "#e0af68";
|
||||
static const char color12[] = "#7aa2f7";
|
||||
static const char color13[] = "#bb9af7";
|
||||
static const char color14[] = "#7dcfff";
|
||||
static const char color15[] = "#c0caf5";
|
||||
static const char bordernorm[] = "#383c4a";
|
||||
static const char bordersel[] = "#7aa2f7";
|
||||
|
||||
static const char *barschemes[7][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = {colors[15], colors[0], colors[16]},
|
||||
[SchemeSel] = {colors[15], colors[4], colors[17]},
|
||||
[SchemeStatus] = {colors[7], colors[0], "#000000"}, // Statusbar right
|
||||
[SchemeTagsSel] = {colors[0], colors[4], "#000000"}, // Tagbar left selected
|
||||
[SchemeTagsNorm] = {colors[7], colors[0], "#000000"}, // Tagbar left unselected
|
||||
[SchemeInfoSel] = {colors[7], colors[0], "#000000"}, // infobar middle selected
|
||||
[SchemeInfoNorm] = {colors[7], colors[0], "#000000"}, // infobar middle unselected
|
||||
static const char *barschemes[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { color15, color0, bordernorm },
|
||||
[SchemeSel] = { color15, color4, bordersel },
|
||||
[SchemeStatus] = { color7, color0, "#000000" }, // Statusbar right
|
||||
[SchemeTagsSel] = { color0, color4, "#000000" }, // Tagbar left selected
|
||||
[SchemeTagsNorm] = { color7, color0, "#000000" }, // Tagbar left unselected
|
||||
[SchemeInfoSel] = { color7, color0, "#000000" }, // infobar middle selected
|
||||
[SchemeInfoNorm] = { color7, color0, "#000000" }, // infobar middle unselected
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
|
|
2
drw.c
2
drw.c
|
@ -174,7 +174,7 @@ void drw_clr_create(Drw *drw, Clr *dest, const char *clrname) {
|
|||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||
* returned color scheme when done using it. */
|
||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) {
|
||||
size_t i;
|
||||
int i;
|
||||
Clr *ret;
|
||||
|
||||
/* need at least two colors for a scheme */
|
||||
|
|
6
dwm.c
6
dwm.c
|
@ -381,6 +381,11 @@ static xcb_connection_t *xcon;
|
|||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
static const char *colors[] = {
|
||||
color0, color1, color2, color3, color4, color5, color6, color7,
|
||||
color8, color9, color10, color11, color12, color13, color14, color15,
|
||||
};
|
||||
|
||||
struct Pertag {
|
||||
unsigned int curtag, prevtag; /* current and previous tag */
|
||||
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
|
||||
|
@ -2313,7 +2318,6 @@ void setup(void) {
|
|||
scheme[i] = drw_scm_create(drw, barschemes[i], 3);
|
||||
|
||||
barclrs = ecalloc(LENGTH(colors), sizeof(Clr));
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
drw_clr_create(drw, &barclrs[i], colors[i]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue