Save the notification's scriptrun in script_run field

This commit is contained in:
Benedikt Heine 2018-09-06 08:36:28 +02:00
parent faec6bdbca
commit c692d222d7
3 changed files with 12 additions and 4 deletions

View File

@ -92,6 +92,11 @@ void notification_run_script(notification *n)
if (!n->script || strlen(n->script) < 1)
return;
if (n->script_run && !settings.always_run_script)
return;
n->script_run = true;
const char *appname = n->appname ? n->appname : "";
const char *summary = n->summary ? n->summary : "";
const char *body = n->body ? n->body : "";
@ -268,6 +273,8 @@ notification *notification_create(void)
n->transient = false;
n->progress = -1;
n->script_run = false;
n->fullscreen = FS_SHOW;
return n;

View File

@ -77,6 +77,7 @@ typedef struct _notification {
int dup_count; /**< amount of duplicate notifications stacked onto this */
int displayed_height;
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 */
char *msg; /**< formatted message */
@ -139,6 +140,9 @@ int notification_is_duplicate(const notification *a, const notification *b);
/**
* Run the script associated with the
* 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);
/**

View File

@ -374,10 +374,7 @@ void queues_update(bool fullscreen)
}
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_insert_sorted(displayed, n, notification_cmp_data, NULL);