Unverified Commit 81fb57ec authored by Benjamin Vergnaud's avatar Benjamin Vergnaud Committed by GitHub

Add client flags to turn dnd on/off (#169)

parent b65a08bb
......@@ -12,6 +12,8 @@ _swaync-client() {
-cp
-d
-D
-dn
-df
-c
-C
-sw
......@@ -29,6 +31,8 @@ _swaync-client() {
--close-panel
--toggle-dnd
--get-dnd
--dnd-on
--dnd-off
--count
--hide-latest
--close-latest
......
......@@ -8,6 +8,8 @@ complete -c swaync-client -s op -l open-panel --description "Opens the notificai
complete -c swaync-client -s cp -l close-panel --description "Closes the notificaion panel" -r
complete -c swaync-client -s d -l toggle-dnd --description "Toggle and print the current dnd state" -r
complete -c swaync-client -s D -l get-dnd --description "Print the current dnd state" -r
complete -c swaync-client -s dn -l dnd-on --description "Turn dnd on and print the new dnd state" -r
complete -c swaync-client -s df -l dnd-off --description "Turn dnd off and print the new dnd state" -r
complete -c swaync-client -s c -l count --description "Print the current notificaion count" -r
complete -c swaync-client -l hide-latest --description "Hides latest notification. Still shown in Control Center" -r
complete -c swaync-client -l close-latest --description "Closes latest notification" -r
......
......@@ -10,6 +10,8 @@ _arguments -s \
'(-cp --close-panel)'{-cp,--close-panel}'[Closes the notificaion panel]' \
'(-d --toggle-dnd)'{-d,--toggle-dnd}'[Toggle and print the current dnd state]' \
'(-D --get-dnd)'{-D,--get-dnd}'[Print the current dnd state]' \
'(-dn --dnd-on)'{-dn,--dnd-on}'[Turn dnd on and print the new dnd state]' \
'(-df --dnd-off)'{-df,--dnd-off}'[Turn dnd off and print the new dnd state]' \
'(-c --count)'{-c,--count}'[Print the current notificaion count]' \
'(--hide-latest)'--hide-latest'[Closes all notifications]' \
'(--close-latest)'--close-latest'[Hides latest notification. Still shown in Control Center]' \
......
......@@ -37,6 +37,12 @@ swaync-client - Client executable
*-D, --get-dnd*
Print the current dnd state
*-dn, --dnd-on*
Turn dnd on and print the new dnd state
*-df, --dnd-off*
Turn dnd off and print the new dnd state
*-c, --count*
Print the current notificaion count
......
......@@ -19,6 +19,8 @@ interface CcDaemon : Object {
public abstract bool get_dnd () throws DBusError, IOError;
public abstract void set_dnd (bool state) throws DBusError, IOError;
public abstract bool get_visibility () throws DBusError, IOError;
public abstract void toggle_visibility () throws DBusError, IOError;
......@@ -49,6 +51,8 @@ private void print_help (string[] args) {
print ("\t -cp, \t --close-panel \t\t Closes the notificaion panel\n");
print ("\t -d, \t --toggle-dnd \t\t Toggle and print the current dnd state\n");
print ("\t -D, \t --get-dnd \t\t Print the current dnd state\n");
print ("\t -dn, \t --dnd-on \t\t Turn dnd on and print the new dnd state\n");
print ("\t -df, \t --dnd-off \t\t Turn dnd off and print the new dnd state\n");
print ("\t -c, \t --count \t\t Print the current notificaion count\n");
print ("\t \t --hide-latest \t\t Hides latest notification. Still shown in Control Center\n");
print ("\t \t --close-latest \t Closes latest notification\n");
......@@ -161,6 +165,16 @@ public int command_line (string[] args) {
case "-D":
print (cc_daemon.get_dnd ().to_string ());
break;
case "--dnd-on":
case "-dn":
cc_daemon.set_dnd (true);
print (cc_daemon.get_dnd ().to_string ());
break;
case "--dnd-off":
case "-df":
cc_daemon.set_dnd (false);
print (cc_daemon.get_dnd ().to_string ());
break;
case "--subscribe":
case "-s":
cc_daemon.subscribe.connect (on_subscribe);
......
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