diff --git a/cava.c b/cava.c index 286ad61..8bd3d13 100644 --- a/cava.c +++ b/cava.c @@ -79,7 +79,7 @@ struct termios oldtio, newtio; int rc; int M = 2048; - +int output_mode; @@ -90,10 +90,12 @@ int should_reload = 0; // general: cleanup void cleanup(void) { - #ifdef NCURSES - cleanup_terminal_ncurses(); - #endif - cleanup_terminal_noncurses(); + if (output_mode == 1 || output_mode == 2 ) { + cleanup_terminal_ncurses(); + } + else if (output_mode ==3 ) { + cleanup_terminal_noncurses(); + } } // general: handle signals @@ -316,6 +318,8 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co //config: load load_config(configPath, supportedInput, (void *)&p); + output_mode = p.om; + if (p.om != 4) { // Check if we're running in a tty inAtty = 0; diff --git a/config.c b/config.c index ea1b71c..3c13d68 100644 --- a/config.c +++ b/config.c @@ -212,6 +212,17 @@ if (!validate_color(p->bcolor, p->om)) { exit(EXIT_FAILURE); } +if (p->gradient) { + if (!validate_color(p->gradient_color_1, p->om)) { + fprintf(stderr, "The first gradient color is invalid. It must be HTML color of the form '#xxxxxx'.\n"); + exit(EXIT_FAILURE); + } + if (!validate_color(p->gradient_color_2, p->om)) { + fprintf(stderr, "The second gradient color is invalid. It must be HTML color of the form '#xxxxxx'.\n"); + exit(EXIT_FAILURE); + } +} + // In case color is not html format set bgcol and col to predefinedint values p->col = 6; if (strcmp(p->color, "black") == 0) p->col = 0; diff --git a/output/terminal_noncurses.c b/output/terminal_noncurses.c index e571e84..68ff1e6 100644 --- a/output/terminal_noncurses.c +++ b/output/terminal_noncurses.c @@ -71,9 +71,9 @@ int init_terminal_noncurses(int col, int bgcol, int w, int h, int bw) { printf("\033[1m"); //setting "bright" color mode, looks cooler... I think - if (bgcol != 0) + if (bgcol != 0) { printf("\033[%dm", bgcol); - { + for (n = (h); n >= 0; n--) { for (i = 0; i < w; i++) {