add option to run scripts for suppressed notifications - fix #212
This commit is contained in:
		
							parent
							
								
									08fa6ea998
								
							
						
					
					
						commit
						504477edc1
					
				| @ -115,6 +115,10 @@ print version information. | |||||||
| 
 | 
 | ||||||
| use alternative config file. | use alternative config file. | ||||||
| 
 | 
 | ||||||
|  | =item B<-always_run_script> | ||||||
|  | 
 | ||||||
|  | Always run rule-defined scripts, even if the notification is suppressed with format = "". | ||||||
|  | 
 | ||||||
| =back | =back | ||||||
| 
 | 
 | ||||||
| =head1 FORMAT | =head1 FORMAT | ||||||
|  | |||||||
| @ -462,6 +462,9 @@ int notification_init(notification * n, int id) | |||||||
| 
 | 
 | ||||||
|         if (strlen(n->msg) == 0) { |         if (strlen(n->msg) == 0) { | ||||||
|                 notification_close(n, 2); |                 notification_close(n, 2); | ||||||
|  |                 if (settings.always_run_script) { | ||||||
|  |                         notification_run_script(n); | ||||||
|  |                 } | ||||||
|                 printf("skipping notification: %s %s\n", n->body, n->summary); |                 printf("skipping notification: %s %s\n", n->body, n->summary); | ||||||
|         } else { |         } else { | ||||||
|                 g_queue_insert_sorted(queue, n, notification_cmp_data, NULL); |                 g_queue_insert_sorted(queue, n, notification_cmp_data, NULL); | ||||||
|  | |||||||
| @ -322,6 +322,10 @@ void load_settings(char *cmdline_config_path) | |||||||
|             cmdline_get_bool("-print", false, |             cmdline_get_bool("-print", false, | ||||||
|                              "Print notifications to cmdline (DEBUG)"); |                              "Print notifications to cmdline (DEBUG)"); | ||||||
| 
 | 
 | ||||||
|  |         settings.always_run_script = | ||||||
|  |             option_get_bool("global", "always_run_script", "-always_run_script", true, | ||||||
|  |                               "Always run rule-defined scripts, even if the notification is suppressed with format = \"\"."); | ||||||
|  | 
 | ||||||
|         /* push hardcoded default rules into rules list */ |         /* push hardcoded default rules into rules list */ | ||||||
|         for (int i = 0; i < LENGTH(default_rules); i++) { |         for (int i = 0; i < LENGTH(default_rules); i++) { | ||||||
|                 rules = g_slist_insert(rules, &(default_rules[i]), -1); |                 rules = g_slist_insert(rules, &(default_rules[i]), -1); | ||||||
|  | |||||||
| @ -51,6 +51,7 @@ typedef struct _settings { | |||||||
|         enum icon_position_t icon_position; |         enum icon_position_t icon_position; | ||||||
|         char *icon_folders; |         char *icon_folders; | ||||||
|         enum follow_mode f_mode; |         enum follow_mode f_mode; | ||||||
|  |         bool always_run_script; | ||||||
|         keyboard_shortcut close_ks; |         keyboard_shortcut close_ks; | ||||||
|         keyboard_shortcut close_all_ks; |         keyboard_shortcut close_all_ks; | ||||||
|         keyboard_shortcut history_ks; |         keyboard_shortcut history_ks; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Spencer
						Spencer