Use notification_colors struct in settings
This commit is contained in:
		
							parent
							
								
									c3cd623f41
								
							
						
					
					
						commit
						3e205ff159
					
				
							
								
								
									
										12
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								config.h
									
									
									
									
									
								
							| @ -4,12 +4,12 @@ struct settings defaults = { | ||||
| 
 | ||||
| .font = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*", | ||||
| .markup = MARKUP_NO, | ||||
| .normbgcolor = "#1793D1", | ||||
| .normfgcolor = "#DDDDDD", | ||||
| .critbgcolor = "#ffaaaa", | ||||
| .critfgcolor = "#000000", | ||||
| .lowbgcolor = "#aaaaff", | ||||
| .lowfgcolor = "#000000", | ||||
| .colors_norm.bg = "#1793D1", | ||||
| .colors_norm.fg = "#DDDDDD", | ||||
| .colors_crit.bg = "#ffaaaa", | ||||
| .colors_crit.fg = "#000000", | ||||
| .colors_low.bg = "#aaaaff", | ||||
| .colors_low.fg = "#000000", | ||||
| .format = "%s %b",         /* default format */ | ||||
| 
 | ||||
| .timeouts = { S2US(10), S2US(10), S2US(0) }, /* low, normal, critical */ | ||||
|  | ||||
| @ -2,7 +2,12 @@ | ||||
| #ifndef DUNST_MARKUP_H | ||||
| #define DUNST_MARKUP_H | ||||
| 
 | ||||
| #include "settings.h" | ||||
| enum markup_mode { | ||||
|         MARKUP_NULL, | ||||
|         MARKUP_NO, | ||||
|         MARKUP_STRIP, | ||||
|         MARKUP_FULL | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  * Strip any markup from text; turn it in to plain text. | ||||
|  | ||||
| @ -5,7 +5,7 @@ | ||||
| #include <glib.h> | ||||
| #include <stdbool.h> | ||||
| 
 | ||||
| #include "settings.h" | ||||
| #include "markup.h" | ||||
| 
 | ||||
| #define DUNST_NOTIF_MAX_CHARS 5000 | ||||
| 
 | ||||
|  | ||||
| @ -621,19 +621,19 @@ void load_settings(char *cmdline_config_path) | ||||
|                 g_free(c); | ||||
|         } | ||||
| 
 | ||||
|         settings.lowbgcolor = option_get_string( | ||||
|         settings.colors_low.bg = option_get_string( | ||||
|                 "urgency_low", | ||||
|                 "background", "-lb", defaults.lowbgcolor, | ||||
|                 "background", "-lb", defaults.colors_low.bg, | ||||
|                 "Background color for notifications with low urgency" | ||||
|         ); | ||||
| 
 | ||||
|         settings.lowfgcolor = option_get_string( | ||||
|         settings.colors_low.fg = option_get_string( | ||||
|                 "urgency_low", | ||||
|                 "foreground", "-lf", defaults.lowfgcolor, | ||||
|                 "foreground", "-lf", defaults.colors_low.fg, | ||||
|                 "Foreground color for notifications with low urgency" | ||||
|         ); | ||||
| 
 | ||||
|         settings.lowframecolor = option_get_string( | ||||
|         settings.colors_low.frame = option_get_string( | ||||
|                 "urgency_low", | ||||
|                 "frame_color", "-lfr", NULL, | ||||
|                 "Frame color for notifications with low urgency" | ||||
| @ -651,19 +651,19 @@ void load_settings(char *cmdline_config_path) | ||||
|                 "Icon for notifications with low urgency" | ||||
|         ); | ||||
| 
 | ||||
|         settings.normbgcolor = option_get_string( | ||||
|         settings.colors_norm.bg = option_get_string( | ||||
|                 "urgency_normal", | ||||
|                 "background", "-nb", defaults.normbgcolor, | ||||
|                 "background", "-nb", defaults.colors_norm.bg, | ||||
|                 "Background color for notifications with normal urgency" | ||||
|         ); | ||||
| 
 | ||||
|         settings.normfgcolor = option_get_string( | ||||
|         settings.colors_norm.fg = option_get_string( | ||||
|                 "urgency_normal", | ||||
|                 "foreground", "-nf", defaults.normfgcolor, | ||||
|                 "foreground", "-nf", defaults.colors_norm.fg, | ||||
|                 "Foreground color for notifications with normal urgency" | ||||
|         ); | ||||
| 
 | ||||
|         settings.normframecolor = option_get_string( | ||||
|         settings.colors_norm.frame = option_get_string( | ||||
|                 "urgency_normal", | ||||
|                 "frame_color", "-nfr", NULL, | ||||
|                 "Frame color for notifications with normal urgency" | ||||
| @ -681,19 +681,19 @@ void load_settings(char *cmdline_config_path) | ||||
|                 "Icon for notifications with normal urgency" | ||||
|         ); | ||||
| 
 | ||||
|         settings.critbgcolor = option_get_string( | ||||
|         settings.colors_crit.bg = option_get_string( | ||||
|                 "urgency_critical", | ||||
|                 "background", "-cb", defaults.critbgcolor, | ||||
|                 "background", "-cb", defaults.colors_crit.bg, | ||||
|                 "Background color for notifications with critical urgency" | ||||
|         ); | ||||
| 
 | ||||
|         settings.critfgcolor = option_get_string( | ||||
|         settings.colors_crit.fg = option_get_string( | ||||
|                 "urgency_critical", | ||||
|                 "foreground", "-cf", defaults.critfgcolor, | ||||
|                 "Foreground color for notifications with critical urgency" | ||||
|                 "foreground", "-cf", defaults.colors_crit.fg, | ||||
|                 "Foreground color for notifications with ciritical urgency" | ||||
|         ); | ||||
| 
 | ||||
|         settings.critframecolor = option_get_string( | ||||
|         settings.colors_crit.frame = option_get_string( | ||||
|                 "urgency_critical", | ||||
|                 "frame_color", "-cfr", NULL, | ||||
|                 "Frame color for notifications with critical urgency" | ||||
|  | ||||
| @ -4,6 +4,8 @@ | ||||
| 
 | ||||
| #include <stdbool.h> | ||||
| 
 | ||||
| #include "markup.h" | ||||
| #include "notification.h" | ||||
| #include "x11/x.h" | ||||
| 
 | ||||
| enum alignment { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT }; | ||||
| @ -11,7 +13,6 @@ enum ellipsize { ELLIPSE_START, ELLIPSE_MIDDLE, ELLIPSE_END }; | ||||
| enum icon_position { ICON_LEFT, ICON_RIGHT, ICON_OFF }; | ||||
| enum separator_color { SEP_FOREGROUND, SEP_AUTO, SEP_FRAME, SEP_CUSTOM }; | ||||
| enum follow_mode { FOLLOW_NONE, FOLLOW_MOUSE, FOLLOW_KEYBOARD }; | ||||
| enum markup_mode { MARKUP_NULL, MARKUP_NO, MARKUP_STRIP, MARKUP_FULL }; | ||||
| enum mouse_action { MOUSE_NONE, MOUSE_DO_ACTION, MOUSE_CLOSE_CURRENT, MOUSE_CLOSE_ALL }; | ||||
| 
 | ||||
| struct geometry { | ||||
| @ -33,15 +34,9 @@ struct settings { | ||||
|         bool stack_duplicates; | ||||
|         bool hide_duplicate_count; | ||||
|         char *font; | ||||
|         char *normbgcolor; | ||||
|         char *normfgcolor; | ||||
|         char *normframecolor; | ||||
|         char *critbgcolor; | ||||
|         char *critfgcolor; | ||||
|         char *critframecolor; | ||||
|         char *lowbgcolor; | ||||
|         char *lowfgcolor; | ||||
|         char *lowframecolor; | ||||
|         struct notification_colors colors_low; | ||||
|         struct notification_colors colors_norm; | ||||
|         struct notification_colors colors_crit; | ||||
|         char *format; | ||||
|         gint64 timeouts[3]; | ||||
|         char *icons[3]; | ||||
|  | ||||
							
								
								
									
										24
									
								
								src/x11/x.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								src/x11/x.c
									
									
									
									
									
								
							| @ -464,24 +464,24 @@ void x_setup(void) | ||||
|         x_shortcut_grab(&settings.context_ks); | ||||
|         x_shortcut_ungrab(&settings.context_ks); | ||||
| 
 | ||||
|         xctx.colors[ColFG][URG_LOW] = settings.lowfgcolor; | ||||
|         xctx.colors[ColFG][URG_NORM] = settings.normfgcolor; | ||||
|         xctx.colors[ColFG][URG_CRIT] = settings.critfgcolor; | ||||
|         xctx.colors[ColFG][URG_LOW] = settings.colors_low.fg; | ||||
|         xctx.colors[ColFG][URG_NORM] = settings.colors_norm.fg; | ||||
|         xctx.colors[ColFG][URG_CRIT] = settings.colors_crit.fg; | ||||
| 
 | ||||
|         xctx.colors[ColBG][URG_LOW] = settings.lowbgcolor; | ||||
|         xctx.colors[ColBG][URG_NORM] = settings.normbgcolor; | ||||
|         xctx.colors[ColBG][URG_CRIT] = settings.critbgcolor; | ||||
|         xctx.colors[ColBG][URG_LOW] = settings.colors_low.bg; | ||||
|         xctx.colors[ColBG][URG_NORM] = settings.colors_norm.bg; | ||||
|         xctx.colors[ColBG][URG_CRIT] = settings.colors_crit.bg; | ||||
| 
 | ||||
|         if (settings.lowframecolor) | ||||
|                 xctx.colors[ColFrame][URG_LOW] = settings.lowframecolor; | ||||
|         if (settings.colors_low.frame) | ||||
|                 xctx.colors[ColFrame][URG_LOW] = settings.colors_low.frame; | ||||
|         else | ||||
|                 xctx.colors[ColFrame][URG_LOW] = settings.frame_color; | ||||
|         if (settings.normframecolor) | ||||
|                 xctx.colors[ColFrame][URG_NORM] = settings.normframecolor; | ||||
|         if (settings.colors_norm.frame) | ||||
|                 xctx.colors[ColFrame][URG_NORM] = settings.colors_norm.frame; | ||||
|         else | ||||
|                 xctx.colors[ColFrame][URG_NORM] = settings.frame_color; | ||||
|         if (settings.critframecolor) | ||||
|                 xctx.colors[ColFrame][URG_CRIT] = settings.critframecolor; | ||||
|         if (settings.colors_crit.frame) | ||||
|                 xctx.colors[ColFrame][URG_CRIT] = settings.colors_crit.frame; | ||||
|         else | ||||
|                 xctx.colors[ColFrame][URG_CRIT] = settings.frame_color; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Benedikt Heine
						Benedikt Heine