reintroduced config.h
This commit is contained in:
		
							parent
							
								
									d4f38c0533
								
							
						
					
					
						commit
						311e2ff437
					
				
							
								
								
									
										6
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								Makefile
									
									
									
									
									
								
							| @ -18,7 +18,11 @@ options: | |||||||
| 	@echo CC -c $< | 	@echo CC -c $< | ||||||
| 	@${CC} -c $< ${CFLAGS} | 	@${CC} -c $< ${CFLAGS} | ||||||
| 
 | 
 | ||||||
| ${OBJ}: config.mk | ${OBJ}: config.h config.mk | ||||||
|  | 
 | ||||||
|  | config.h: | ||||||
|  | 	@echo creating $@ from config.def.h | ||||||
|  | 	@cp config.def.h $@ | ||||||
| 
 | 
 | ||||||
| dunst: draw.o dunst.o list.o dunst_dbus.o ini.o utils.o | dunst: draw.o dunst.o list.o dunst_dbus.o ini.o utils.o | ||||||
| 	@echo CC -o $@ | 	@echo CC -o $@ | ||||||
|  | |||||||
							
								
								
									
										31
									
								
								config.def.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								config.def.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | |||||||
|  | /* see example dunstrc for additional explanations about these options */ | ||||||
|  | 
 | ||||||
|  | char *font = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*"; | ||||||
|  | char *normbgcolor = "#1793D1"; | ||||||
|  | char *normfgcolor = "#DDDDDD"; | ||||||
|  | char *critbgcolor = "#ffaaaa"; | ||||||
|  | char *critfgcolor = "#000000"; | ||||||
|  | char *lowbgcolor = "#aaaaff"; | ||||||
|  | char *lowfgcolor = "#000000"; | ||||||
|  | char *format = "%s %b";         /* default format */ | ||||||
|  | 
 | ||||||
|  | int timeouts[] = { 10, 10, 0 }; /* low, normal, critical */ | ||||||
|  | 
 | ||||||
|  | char *geom = "0x0";             /* geometry */ | ||||||
|  | int sort = True;                /* sort messages by urgency */ | ||||||
|  | int indicate_hidden = True;     /* show count of hidden messages */ | ||||||
|  | int idle_threshold = 0;         /* don't timeout notifications when idle for x seconds */ | ||||||
|  | int show_age_threshold = -1;    /* show age of notification, when notification is older than x seconds */ | ||||||
|  | enum alignment align = left;    /* text alignment [left/center/right] */ | ||||||
|  | int sticky_history = True; | ||||||
|  | int verbosity = 0; | ||||||
|  | 
 | ||||||
|  | /* keyboard shortcuts */ | ||||||
|  | keyboard_shortcut close_ks = {.str = "ctrl+space", | ||||||
|  |                        .code = 0, .sym = NoSymbol,.is_valid = False}; /* ignore this */ | ||||||
|  | 
 | ||||||
|  | keyboard_shortcut close_all_ks = {.str = "ctrl+shift+space", | ||||||
|  |                        .code = 0, .sym = NoSymbol,.is_valid = False}; /* ignore this */ | ||||||
|  | 
 | ||||||
|  | keyboard_shortcut history_ks = {.str = "ctrl+grave", | ||||||
|  |                        .code = 0, .sym = NoSymbol,.is_valid = False}; /* ignore this */ | ||||||
| @ -7,7 +7,6 @@ VERSION="pre-0.3.0" | |||||||
| X11INC = /usr/X11R6/include | X11INC = /usr/X11R6/include | ||||||
| X11LIB = /usr/X11R6/lib | X11LIB = /usr/X11R6/lib | ||||||
| 
 | 
 | ||||||
| # Xft, comment if you don't want it
 |  | ||||||
| XFTINC = -I/usr/include/freetype2 | XFTINC = -I/usr/include/freetype2 | ||||||
| XFTLIBS  = -lXft | XFTLIBS  = -lXft | ||||||
| 
 | 
 | ||||||
| @ -15,6 +14,9 @@ XFTLIBS  = -lXft | |||||||
| XINERAMALIBS  = -lXinerama | XINERAMALIBS  = -lXinerama | ||||||
| XINERAMAFLAGS = -DXINERAMA | XINERAMAFLAGS = -DXINERAMA | ||||||
| 
 | 
 | ||||||
|  | # uncomment to disable parsing of dunstrc
 | ||||||
|  | STATIC= -DSTATIC_CONFIG | ||||||
|  | 
 | ||||||
| # inih flags
 | # inih flags
 | ||||||
| INIFLAGS = -DINI_ALLOW_MULTILINE=0 | INIFLAGS = -DINI_ALLOW_MULTILINE=0 | ||||||
| 
 | 
 | ||||||
| @ -24,5 +26,5 @@ LIBS = -L${X11LIB} -lX11 -lXss ${XFTLIBS} ${XINERAMALIBS} $(shell pkg-config --l | |||||||
| 
 | 
 | ||||||
| # flags
 | # flags
 | ||||||
| CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ${INIFLAGS} | CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ${INIFLAGS} | ||||||
| CFLAGS   = -g --std=c99 -pedantic -Wall -Wno-overlength-strings -Os ${INCS} ${CPPFLAGS} | CFLAGS   = -g --std=c99 -pedantic -Wall -Wno-overlength-strings -Os ${INCS} ${STATIC} ${CPPFLAGS} | ||||||
| LDFLAGS  = ${LIBS} | LDFLAGS  = ${LIBS} | ||||||
|  | |||||||
							
								
								
									
										45
									
								
								dunst.c
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								dunst.c
									
									
									
									
									
								
							| @ -26,6 +26,7 @@ | |||||||
| #include "ini.h" | #include "ini.h" | ||||||
| #include "utils.h" | #include "utils.h" | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| #define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh)) | #define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh)) | ||||||
| #define LENGTH(X)               (sizeof X / sizeof X[0]) | #define LENGTH(X)               (sizeof X / sizeof X[0]) | ||||||
| #define MIN(a,b)                ((a) < (b) ? (a) : (b)) | #define MIN(a,b)                ((a) < (b) ? (a) : (b)) | ||||||
| @ -53,29 +54,14 @@ typedef struct _notification_buffer { | |||||||
|         int x_offset; |         int x_offset; | ||||||
| } notification_buffer; | } notification_buffer; | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| /* global variables */ | /* global variables */ | ||||||
|  /* extern */ |  | ||||||
| int verbosity = 0; |  | ||||||
| 
 | 
 | ||||||
| char *font = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*"; | #include "config.h" | ||||||
| char *normbgcolor = "#1793D1"; |  | ||||||
| char *normfgcolor = "#DDDDDD"; |  | ||||||
| char *critbgcolor = "#ffaaaa"; |  | ||||||
| char *critfgcolor = "#000000"; |  | ||||||
| char *lowbgcolor = "#aaaaff"; |  | ||||||
| char *lowfgcolor = "#000000"; |  | ||||||
| char *format = "%s %b";         /* default format */ |  | ||||||
| int timeouts[] = { 10, 10, 0 }; /* low, normal, critical */ |  | ||||||
| 
 | 
 | ||||||
| char *geom = "0x0";             /* geometry */ |  | ||||||
| int height_limit; | int height_limit; | ||||||
| int sort = True;                /* sort messages by urgency */ |  | ||||||
| int indicate_hidden = True;     /* show count of hidden messages */ |  | ||||||
| int idle_threshold = 0; |  | ||||||
| int show_age_threshold = -1; |  | ||||||
| enum alignment align = left; |  | ||||||
| int sticky_history = True; |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| list *rules = NULL; | list *rules = NULL; | ||||||
| /* index of colors fit to urgency level */ | /* index of colors fit to urgency level */ | ||||||
| @ -86,18 +72,6 @@ static DC *dc; | |||||||
| static Window win; | static Window win; | ||||||
| static time_t now; | static time_t now; | ||||||
| static int visible = False; | static int visible = False; | ||||||
| static keyboard_shortcut close_ks = {.str = NULL,.code = 0,.sym = |  | ||||||
|             NoSymbol,.mask = 0,.is_valid = False |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static keyboard_shortcut close_all_ks = {.str = NULL,.code = 0,.sym = |  | ||||||
|             NoSymbol,.mask = 0,.is_valid = False |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static keyboard_shortcut history_ks = {.str = NULL,.code = 0,.sym = |  | ||||||
|             NoSymbol,.mask = 0,.is_valid = False |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static screen_info scr; | static screen_info scr; | ||||||
| static dimension_t geometry; | static dimension_t geometry; | ||||||
| static XScreenSaverInfo *screensaver_info; | static XScreenSaverInfo *screensaver_info; | ||||||
| @ -1265,6 +1239,7 @@ void parse_cmdline(int argc, char *argv[]) | |||||||
|         } |         } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | #ifndef STATIC_CONFIG | ||||||
| static int dunst_ini_get_boolean(const char *value) | static int dunst_ini_get_boolean(const char *value) | ||||||
| { | { | ||||||
|         switch (value[0]) { |         switch (value[0]) { | ||||||
| @ -1448,7 +1423,6 @@ void parse_dunstrc(char *cmdline_config_path) | |||||||
|         FILE *config_file = NULL; |         FILE *config_file = NULL; | ||||||
| 
 | 
 | ||||||
|         xdgInitHandle(&xdg); |         xdgInitHandle(&xdg); | ||||||
|         rules = l_init(); |  | ||||||
| 
 | 
 | ||||||
|         if (cmdline_config_path != NULL) { |         if (cmdline_config_path != NULL) { | ||||||
|                 config_file = fopen(cmdline_config_path, "r"); |                 config_file = fopen(cmdline_config_path, "r"); | ||||||
| @ -1476,6 +1450,7 @@ void parse_dunstrc(char *cmdline_config_path) | |||||||
| 
 | 
 | ||||||
|         print_rules(); |         print_rules(); | ||||||
| } | } | ||||||
|  | #endif /* STATIC_CONFIG */ | ||||||
| 
 | 
 | ||||||
| char *parse_cmdline_for_config_file(int argc, char *argv[]) | char *parse_cmdline_for_config_file(int argc, char *argv[]) | ||||||
| { | { | ||||||
| @ -1493,12 +1468,14 @@ char *parse_cmdline_for_config_file(int argc, char *argv[]) | |||||||
| 
 | 
 | ||||||
| int main(int argc, char *argv[]) | int main(int argc, char *argv[]) | ||||||
| { | { | ||||||
|         char *cmdline_config_path; |  | ||||||
|         now = time(&now); |         now = time(&now); | ||||||
| 
 | 
 | ||||||
|  |         rules = l_init(); | ||||||
|  | #ifndef STATIC_CONFIG | ||||||
|  |         char *cmdline_config_path; | ||||||
|         cmdline_config_path = parse_cmdline_for_config_file(argc, argv); |         cmdline_config_path = parse_cmdline_for_config_file(argc, argv); | ||||||
| 
 |  | ||||||
|         parse_dunstrc(cmdline_config_path); |         parse_dunstrc(cmdline_config_path); | ||||||
|  | #endif | ||||||
|         parse_cmdline(argc, argv); |         parse_cmdline(argc, argv); | ||||||
|         dc = initdc(); |         dc = initdc(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sascha Kruse
						Sascha Kruse