more options for separator color
This commit is contained in:
		
							parent
							
								
									3175b041b1
								
							
						
					
					
						commit
						f2075a3409
					
				| @ -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"; | ||||
|  | ||||
							
								
								
									
										24
									
								
								dunst.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								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); | ||||
|                 } | ||||
|         } | ||||
|  | ||||
							
								
								
									
										2
									
								
								dunst.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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 { | ||||
|  | ||||
							
								
								
									
										7
									
								
								dunstrc
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								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 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sascha Kruse
						Sascha Kruse