Skip to content

Commit

Permalink
Merge pull request dunst-project#230 from springworm/always_script
Browse files Browse the repository at this point in the history
Add option to always run script (even for suppressed notifications)
  • Loading branch information
knopwob committed Jul 1, 2015
2 parents 08fa6ea + 2ce9b72 commit b7eb981
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.pod
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ print version information.

use alternative config file.

=item B<-always_run_script>

Always run rule-defined scripts, even if the notification is suppressed with format = "".

=back

=head1 FORMAT
Expand Down
3 changes: 3 additions & 0 deletions notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ int notification_init(notification * n, int id)

if (strlen(n->msg) == 0) {
notification_close(n, 2);
if (settings.always_run_script) {
notification_run_script(n);
}
printf("skipping notification: %s %s\n", n->body, n->summary);
} else {
g_queue_insert_sorted(queue, n, notification_cmp_data, NULL);
Expand Down
4 changes: 4 additions & 0 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ void load_settings(char *cmdline_config_path)
cmdline_get_bool("-print", false,
"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 */
for (int i = 0; i < LENGTH(default_rules); i++) {
rules = g_slist_insert(rules, &(default_rules[i]), -1);
Expand Down
1 change: 1 addition & 0 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ typedef struct _settings {
enum icon_position_t icon_position;
char *icon_folders;
enum follow_mode f_mode;
bool always_run_script;
keyboard_shortcut close_ks;
keyboard_shortcut close_all_ks;
keyboard_shortcut history_ks;
Expand Down

0 comments on commit b7eb981

Please sign in to comment.