Save the notification's scriptrun in script_run field
This commit is contained in:
		
							parent
							
								
									faec6bdbca
								
							
						
					
					
						commit
						c692d222d7
					
				| @ -92,6 +92,11 @@ void notification_run_script(notification *n) | |||||||
|         if (!n->script || strlen(n->script) < 1) |         if (!n->script || strlen(n->script) < 1) | ||||||
|                 return; |                 return; | ||||||
| 
 | 
 | ||||||
|  |         if (n->script_run && !settings.always_run_script) | ||||||
|  |                 return; | ||||||
|  | 
 | ||||||
|  |         n->script_run = true; | ||||||
|  | 
 | ||||||
|         const char *appname = n->appname ? n->appname : ""; |         const char *appname = n->appname ? n->appname : ""; | ||||||
|         const char *summary = n->summary ? n->summary : ""; |         const char *summary = n->summary ? n->summary : ""; | ||||||
|         const char *body = n->body ? n->body : ""; |         const char *body = n->body ? n->body : ""; | ||||||
| @ -268,6 +273,8 @@ notification *notification_create(void) | |||||||
|         n->transient = false; |         n->transient = false; | ||||||
|         n->progress = -1; |         n->progress = -1; | ||||||
| 
 | 
 | ||||||
|  |         n->script_run = false; | ||||||
|  | 
 | ||||||
|         n->fullscreen = FS_SHOW; |         n->fullscreen = FS_SHOW; | ||||||
| 
 | 
 | ||||||
|         return n; |         return n; | ||||||
|  | |||||||
| @ -77,6 +77,7 @@ typedef struct _notification { | |||||||
|         int dup_count;          /**< amount of duplicate notifications stacked onto this */ |         int dup_count;          /**< amount of duplicate notifications stacked onto this */ | ||||||
|         int displayed_height; |         int displayed_height; | ||||||
|         enum behavior_fullscreen fullscreen; //!< The instruction what to do with it, when desktop enters fullscreen
 |         enum behavior_fullscreen fullscreen; //!< The instruction what to do with it, when desktop enters fullscreen
 | ||||||
|  |         bool script_run;        /**< Has the script been executed already? */ | ||||||
| 
 | 
 | ||||||
|         /* derived fields */ |         /* derived fields */ | ||||||
|         char *msg;            /**< formatted message */ |         char *msg;            /**< formatted message */ | ||||||
| @ -139,6 +140,9 @@ int notification_is_duplicate(const notification *a, const notification *b); | |||||||
| /**
 | /**
 | ||||||
|  * Run the script associated with the |  * Run the script associated with the | ||||||
|  * given notification. |  * given notification. | ||||||
|  |  * | ||||||
|  |  * If the script of the notification has been executed already and | ||||||
|  |  * settings.always_run_script is not set, do nothing. | ||||||
|  */ |  */ | ||||||
| void notification_run_script(notification *n); | void notification_run_script(notification *n); | ||||||
| /**
 | /**
 | ||||||
|  | |||||||
| @ -374,10 +374,7 @@ void queues_update(bool fullscreen) | |||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 n->start = time_monotonic_now(); |                 n->start = time_monotonic_now(); | ||||||
| 
 |  | ||||||
|                 if (!n->redisplayed && n->script) { |  | ||||||
|                 notification_run_script(n); |                 notification_run_script(n); | ||||||
|                 } |  | ||||||
| 
 | 
 | ||||||
|                 g_queue_delete_link(waiting, iter); |                 g_queue_delete_link(waiting, iter); | ||||||
|                 g_queue_insert_sorted(displayed, n, notification_cmp_data, NULL); |                 g_queue_insert_sorted(displayed, n, notification_cmp_data, NULL); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Benedikt Heine
						Benedikt Heine