Unverified Commit c0aec811 authored by Floris Bartra's avatar Floris Bartra Committed by GitHub

Add --hide-all option (#529)

* Added --hide-all option * Use close_all_notifications method instead of while-loop --------- Co-authored-by: 's avatarErik Reider <35975961+ErikReider@users.noreply.github.com>
parent d4153280
......@@ -45,6 +45,7 @@ _swaync-client() {
--inhibitors-clear
--count
--hide-latest
--hide-all
--close-latest
--close-all
--skip-wait
......
......@@ -17,6 +17,7 @@ complete -c swaync-client -s Ir -l inhibitor-remove --description "Remove an inh
complete -c swaync-client -s Ic -l inhibitors-clear --description "Clears all inhibitors" -r
complete -c swaync-client -s c -l count --description "Print the current notification count" -r
complete -c swaync-client -l hide-latest --description "Hides latest notification. Still shown in Control Center" -r
complete -c swaync-client -l hide-all --description "Hides all notifications. Still shown in Control Center" -r
complete -c swaync-client -l close-latest --description "Closes latest notification" -r
complete -c swaync-client -s C -l close-all --description "Closes all notifications" -r
complete -c swaync-client -s sw -l skip-wait --description "Doesn't wait when swaync hasn't been started" -r
......
......@@ -18,9 +18,10 @@ _arguments -s \
'(-Ir --inhibitor-remove)'{-Ir,--inhibitor-remove}'[Remove an inhibitor]' \
'(-Ic --inhibitors-clear)'{-Ic,--inhibitors-clear}'[Clears all inhibitors]' \
'(-c --count)'{-c,--count}'[Print the current notification count]' \
'(--hide-latest)'--hide-latest'[Closes all notifications]' \
'(--close-latest)'--close-latest'[Hides latest notification. Still shown in Control Center]' \
'(-C --close-all)'{-C,--close-all}'[Closes latest notification]' \
'(--hide-latest)'--hide-latest'[Hides latest notification. Still shown in Control Center]' \
'(--hide-all)'--hide-all'[Hides all notifications. Still shown in Control Center]' \
'(--close-latest)'--close-latest'[Closes latest notification]' \
'(-C --close-all)'{-C,--close-all}'[Closes all notifications]' \
'(-sw --skip-wait)'{-sw,--skip-wait}"[Doesn't wait when swaync hasn't been started]" \
'(-s --subscribe)'{-s,--subscribe}'[Subscribe to notification add and close events]' \
'(-swb --subscribe-waybar)'{-swb,--subscribe-waybar}'[Subscribe to notification add and close events with waybar support. Read README for example]' \
......
......@@ -64,6 +64,9 @@ swaync-client - Client executable
*--hide-latest*
Hides latest notification. Still shown in Control Center
*--hide-all*
Hides all notifications. Still shown in Control Center
*--close-latest*
Closes latest notification
......
......@@ -14,6 +14,8 @@ interface CcDaemon : Object {
public abstract void hide_latest_notifications (bool close) throws DBusError, IOError;
public abstract void hide_all_notifications () throws DBusError, IOError;
public abstract void close_all_notifications () throws DBusError, IOError;
public abstract uint notification_count () throws DBusError, IOError;
......@@ -72,6 +74,7 @@ private void print_help (string[] args) {
print (" -Ic, \t --inhibitors-clear \t\t Clears all inhibitors\n");
print (" -c, \t --count \t\t\t Print the current notification count\n");
print (" \t --hide-latest \t\t\t Hides latest notification. Still shown in Control Center\n");
print (" \t --hide-all \t\t\t Hides all notifications. Still shown in Control Center\n");
print (" \t --close-latest \t\t Closes latest notification\n");
print (" -C, \t --close-all \t\t\t Closes all notifications\n");
print (" -a, \t --action [ACTION_INDEX]\t Invokes the action [ACTION_INDEX] of the latest notification\n");
......@@ -166,6 +169,9 @@ public int command_line (string[] args) {
case "--hide-latest":
cc_daemon.hide_latest_notifications (false);
break;
case "--hide-all":
cc_daemon.hide_all_notifications ();
break;
case "--close-all":
case "-C":
cc_daemon.close_all_notifications ();
......
......@@ -88,6 +88,12 @@ namespace SwayNotificationCenter {
manually_close_notification (id, !close);
}
/** Closes all popup notifications */
public void hide_all_notifications ()
throws DBusError, IOError {
NotificationWindow.instance.close_all_notifications ();
}
/** Activates the `action_index` action of the latest notification */
public void latest_invoke_action (uint32 action_index)
throws DBusError, IOError {
......
......@@ -203,6 +203,12 @@ namespace SwayNotificationCenter {
noti_daemon.hide_latest_notification (close);
}
/** Closes all popup notifications */
public void hide_all_notifications ()
throws DBusError, IOError {
noti_daemon.hide_all_notifications ();
}
/** Closes all popup and controlcenter notifications */
public void close_all_notifications () throws DBusError, IOError {
noti_daemon.close_all_notifications ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment