Merge pull request #230 from springworm/always_script

Add option to always run script (even for suppressed notifications)
This commit is contained in:
Sascha Kruse 2015-07-01 12:22:40 +02:00
commit b7eb981b0b
4 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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;