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