diff --git a/config.def.h b/config.def.h index c86e81e..af7a22d 100644 --- a/config.def.h +++ b/config.def.h @@ -27,7 +27,8 @@ int line_height = 0; /* if line height < font height, it will be raised to fon int separator_height = 2; /* height of the separator line between two notifications */ int padding = 0; int h_padding = 0; /* horizontal padding */ -enum separator_color sep_color = AUTO; /* AUTO or FOREGROUND */ +enum separator_color sep_color = AUTO; /* AUTO, FOREGROUND, FRAME, CUSTOM */ +char *sep_custom_color_str = NULL; /* custom color if sep_color is set to CUSTOM */ int frame_width = 0; char *frame_color = "#888888"; diff --git a/dunst.c b/dunst.c index 308153a..17b7bb2 100644 --- a/dunst.c +++ b/dunst.c @@ -77,6 +77,7 @@ static dimension_t window_dim; static bool pause_display = false; static char **dmenu_cmd; static unsigned long framec; +static unsigned long sep_custom_col; static r_line_cache line_cache; bool dunst_grab_errored = false; @@ -848,8 +849,14 @@ void draw_win(void) double color; if (sep_color == AUTO) color = calculate_foreground_color(line.colors->BG); - else + else if (sep_color == FOREGROUND) color = line.colors->FG; + else if (sep_color == FRAME) + color = framec; + else { + /* CUSTOM */ + color = sep_custom_col; + } drawrect(dc, 0, 0, width + (2*h_padding), separator_height, true, color); dc->y += separator_height; } @@ -1463,6 +1470,12 @@ void setup(void) framec = getcolor(dc, frame_color); + if (sep_color == CUSTOM) { + sep_custom_col = getcolor(dc, sep_custom_color_str); + } else { + sep_custom_col = 0; + } + /* parse and set geometry and monitor position */ if (geom[0] == '-') { geometry.negative_width = true; @@ -1674,9 +1687,12 @@ void load_options(char *cmdline_config_path) sep_color = AUTO; else if (strcmp(c, "foreground") == 0) sep_color = FOREGROUND; - else - fprintf(stderr, - "Warning: Unknown separator color\n"); + else if (strcmp(c, "frame") == 0) + sep_color = FRAME; + else { + sep_color = CUSTOM; + sep_custom_color_str = strdup(c); + } free(c); } } diff --git a/dunst.h b/dunst.h index 824b6ed..a1887d0 100644 --- a/dunst.h +++ b/dunst.h @@ -18,7 +18,7 @@ #define ColBG 0 enum alignment { left, center, right }; -enum separator_color { FOREGROUND, AUTO }; +enum separator_color { FOREGROUND, AUTO, FRAME, CUSTOM }; enum follow_mode { FOLLOW_NONE, FOLLOW_MOUSE, FOLLOW_KEYBOARD }; typedef struct _dimension_t { diff --git a/dunstrc b/dunstrc index d6c129b..ed2b003 100644 --- a/dunstrc +++ b/dunstrc @@ -91,8 +91,11 @@ horizontal_padding = 10 # Define a color for the separator. - # This can either be "auto" or "foreground". "Auto" tries to find a color - # that fits nicely to the background color. + # possible values are: + # * auto: dunst tries to find a color fitting to the background + # * foreground: use the same color as the foreground + # * frame: use the same color as the frame. + # * anything else will be interpreted as a X color separator_color = auto # print a notification on startup