Add a toggle command

This commit is contained in:
David Sauerwein 2018-08-11 11:08:03 +02:00
parent 0e1b5a176a
commit bb60ea7a48
2 changed files with 6 additions and 1 deletions

View File

@ -719,7 +719,8 @@ Example time: "1000ms" "10m"
=head1 MISCELLANEOUS =head1 MISCELLANEOUS
Dunst can be paused by sending a notification with a summary of Dunst can be paused by sending a notification with a summary of
"DUNST_COMMAND_PAUSE" and resumed with a summary of "DUNST_COMMAND_RESUME". "DUNST_COMMAND_PAUSE", resumed with a summary of "DUNST_COMMAND_RESUME" and
toggled with a summary of "DUNST_COMMAND_TOGGLE".
Alternatively you can send SIGUSR1 and SIGUSR2 to pause and unpause Alternatively you can send SIGUSR1 and SIGUSR2 to pause and unpause
respectively. For Example: respectively. For Example:

View File

@ -95,6 +95,10 @@ int queues_notification_insert(notification *n)
pause_displayed = false; pause_displayed = false;
return 0; return 0;
} }
if (strcmp("DUNST_COMMAND_TOGGLE", n->summary) == 0) {
pause_displayed = !pause_displayed;
return 0;
}
if (n->id == 0) { if (n->id == 0) {
n->id = ++next_notification_id; n->id = ++next_notification_id;